U3d:assetsBounld 打包解包
//打包 static void AssetsBuild() { Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets); if (selection.Length <= 0) return; string path = EditorUtility.SaveFilePanel("另存为", Application.streamingAssetsPath + "/data", selection[0].name, "dat"); if (path.Length != 0) { BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, BuildTarget.StandaloneWindows); AssetDatabase.Refresh(); } } //解包 public static IEnumerator LoadAssetsbounld(string path, string name) { string locoPath = path + "/"+name + ".dat"; AssetBundleCreateRequest request = AssetBundle.LoadFromMemoryAsync(File.ReadAllBytes(locoPath)); //异步的方式 yield return request; //等加载完成之后在进行 AssetBundle ab = request.assetBundle; //使用资源 GameObject gameObj = ab.LoadAsset<GameObject>(name); GameObject GO_MainType = Instantiate(gameObj); request.assetBundle.Unload(false); yield return null; }