void Unload() { Caching.CleanCache(); if (listDatas != null) { listDatas.Clear(); listDatas = null; } if (_abmgr != null) { _abmgr.Close(); _abmgr = null; } }
void Unload() { Caching.CleanCache(); if (listDatas != null) { listDatas.Clear(); listDatas = null; } if (_abmgr != null) { _abmgr.Close(); _abmgr = null; } thisSceneData = new SceneData(); objScene = null; }
//void PackageAdd(string SrcFolder, string DestFolder, BuildTarget target) //{ // DirectoryInfo di = new DirectoryInfo(SrcFolder); // foreach (DirectoryInfo child in di.GetDirectories()) // { // string childFolder = child.FullName; // // 场景名 // string scenename = Path.GetFileName(childFolder); // // 场景prefab // string sceneprefabpath = childFolder + "/" + scenename + ".prefab"; // if (!File.Exists(sceneprefabpath)) // { // Debug.LogError("File is not Exist" + sceneprefabpath); // continue; // } // string scenenavprefabpath = childFolder + "/" + scenename + "_nav.prefab"; // if (!File.Exists(scenenavprefabpath)) // { // Debug.LogError("File is not Exist" + scenenavprefabpath); // continue; // } // string scenelightmap = childFolder + "/LightmapFar-0.exr"; // if (!File.Exists(scenelightmap)) // { // Debug.LogError("File is not Exist" + scenelightmap); // continue; // } // bool a = IsPackage(sceneprefabpath, DestFolder, Path.GetFileName(sceneprefabpath)); // bool b = IsPackage(scenenavprefabpath, DestFolder, Path.GetFileName(scenenavprefabpath)); // bool c = IsPackage(scenelightmap, DestFolder, scenename + "_" + Path.GetFileName(scenelightmap)); // if ( !a && !b && !c ) // { // Debug.Log(" MD5 Not Need Update "); // continue; // } // sceneprefabpath = sceneprefabpath.Substring(sceneprefabpath.IndexOf("Assets")); // scenenavprefabpath = scenenavprefabpath.Substring(scenenavprefabpath.IndexOf("Assets")); // scenelightmap = scenelightmap.Substring(scenelightmap.IndexOf("Assets")); // SceneData sd = new SceneData(); // sd.scene = (GameObject)AssetDatabase.LoadAssetAtPath(sceneprefabpath, typeof(UnityEngine.Object)); // Decompose(sd.scene, ref sd, DestFolder); // sd.scene_nav = (GameObject)AssetDatabase.LoadAssetAtPath(scenenavprefabpath, typeof(UnityEngine.Object)); // sd.scene_Lightmap = (Texture2D)AssetDatabase.LoadAssetAtPath(scenelightmap, typeof(UnityEngine.Object)); // mgr.CreateAssetBundlesScene(sd, DestFolder, target); // } //} #endregion #region chai void Decompose(Object go, ref SceneData sd, string DestFolder, string MaterialFolder) { ABMgr mgr = new ABMgr(); mgr.DecomposePre(go, DestFolder, MaterialFolder); sd.scene_nomaterial = mgr.nomaterialscene; sd.scene_material_asset = mgr.materialasset; mgr.DecomposeEnd(); }
static void Transmit() { ABMgr mgr = new ABMgr(); DirectoryInfo di = new DirectoryInfo(mInFolder); foreach (FileInfo fi in di.GetFiles()) { // 判断 if (fi.FullName.EndsWith(".meta")) continue; if (fi.FullName.EndsWith(ABConfig.extensionName)) continue; string fifullname = fi.FullName.Replace("\\", "/"); int index = fifullname.IndexOf("Assets/"); if (index == -1) { Debug.LogError(fifullname + " No Assets"); continue; } // 输出字符串拼接 string fifolder = Path.GetDirectoryName(fi.FullName).Replace("\\", "/"); int childfolderindex = fifullname.IndexOf(mInFolder, 0); if (childfolderindex == -1) { Debug.LogError(childfolderindex + " [between] " + fifullname + " [and] " + mInFolder); continue; } string outfolder = mOutFolder + fifolder.Substring(mInFolder.Length); //Debug.Log("outfolder " + outfolder); // 输入资源 string assefullname = fifullname.Substring(index); UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(assefullname, typeof(UnityEngine.Object)); if (obj == null) { Debug.LogError(assefullname + " [LoadAssetAtPath Failed] "); continue; } // 输出资源 string targetPath = outfolder + "/" + Path.GetFileNameWithoutExtension(fifullname) + ABConfig.extensionName; //Debug.Log("targetPath " + targetPath); bool suc = mgr.CreateAssetBundleOne(obj, targetPath); if (!suc) { Debug.LogError(fifullname + " [CreateAssetBundleOne Failed] " + targetPath); continue; } else Debug.Log("Create " + targetPath); } }