static void Traversal <T>(GameObject go, List <T> reports, Action <GameObject, string, string, List <T> > scanFunc) { if (!go) { return; } try { var assetPath = AssetDatabase.GetAssetPath(go); var hierarchyPath = go.GetHirarchyPath(1); scanFunc(go, assetPath, hierarchyPath, reports); var trans = go.transform; for (int n = 0, cnt = trans.childCount; n < cnt; ++n) { var child = trans.GetChild(n); if (!child) { continue; } ScanAssets.Traversal(child.gameObject, reports, scanFunc); } } catch (Exception e) { Debug.LogWarning(e); } }
public static void BuildBundleName_UI() { ////打包UI ScanAssets.ScanDependencies("ABResources/UI", new List <string>() { ".asset", ".prefab", ".xml", ".json", ".png", ".mat" }, null, HandlDataResources); //打包PIC ScanAssets.ScanDependencies("ABResources/Pic", new List <string>() { ".jpg", ".tga", ".png" }, null, HandlDataResources); }
public static void ClearAllBundleNameMenu() { //清除ABResources ScanAssets.ScanDependencies(Path.Combine(Application.dataPath, ABPathHelper.ABResourcePrefix), null, null, HandleClearSelect); //清除Data ScanAssets.ScanDependencies(Path.Combine(Application.dataPath, ABPathHelper.DataPrefix), null, null, HandleClearSelect); //清除Resources ScanAssets.ScanDependencies(Path.Combine(Application.dataPath, ABPathHelper.ResourcePrefix), null, null, HandleClearSelect); //AssetDatabase.RemoveUnusedAssetBundleNames(); AssetDatabase.Refresh(); Debug.Log("<color=yellow>清除所有AssetBundle名字</color>"); }
public static void BuildBundleName_Other() { //打包PathIdMap ScanAssets.ScanDependencies("ABResources/AutoGenerate", new List <string>() { ".xml" }, null, HandlDataResources); //打包TableConfig ScanAssets.ScanDependencies("ABResources/TableConfig", new List <string>() { ".txt" }, null, HandlDataResources); //打包GameConfig ScanAssets.ScanDependencies("ABResources/GameConfig", new List <string>() { ".xml", ".txt", }, null, HandlDataResources); }
public static void Run(bool deleteMissings) { var reports = ScanAssets.Report <MissingData>(CollectAssets.Collect(CollectAssets.Target.Hierarchy), ScanMissingAssets.Scan); if (0 < reports.Count) { var sb = new StringBuilder(1024); foreach (var missing in reports) { sb.Append(missing.ToString()).Append('\n'); } sb.Append("MISSING COUNT:").Append(reports.Count); if (deleteMissings) { foreach (var missing in reports) { var go = missing.owner; var indexes = missing.indexes; var so = new SerializedObject(go); var prop = so.FindProperty("m_Component"); for (int n = indexes.Count - 1; n >= 0; --n) { prop.DeleteArrayElementAtIndex(indexes[n]); } so.ApplyModifiedProperties(); EditorUtility.SetDirty(go); UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(go.scene); } } Debug.Log(sb.ToString()); } else { Debug.Log("MISSING NOT FOUND!"); } }
public static List <T> Report <T>(List <GameObject> checkList, Action <GameObject, string, string, List <T> > scanFunc) { List <T> reports = new List <T>(); for (int n = 0; n < checkList.Count; ++n) { try { ScanAssets.Traversal <T>(checkList[n], reports, scanFunc); } catch (Exception e) { Debug.LogWarning(e); } } return(reports); }
public static void Run() { var reports = ScanAssets.Report <string>(CollectAssets.Collect(CollectAssets.Target.Hierarchy), ScanNonCachedOImages.Scan); if (0 < reports.Count) { var sb = new StringBuilder(1024); foreach (string log in reports) { sb.Append(log).Append('\n'); } sb.Append("NON-CACHED COUNT:").Append(reports.Count); Debug.Log(sb.ToString()); } else { Debug.Log("NON-CACHED NOT FOUND!"); } }
//打包脚本 private static void BuildScriptTag() { ScanAssets.ScanDependencies("ABResources/Script", null, null, HandleScriptAndItsDepends); }