public static bool FindMissingScriptInCurrentSelection() { string str = ""; Debug.Log("Find Missing Script----------------begin"); EditorUtility.DisplayProgressBar("Find Missing Script In Selection", "", 0); var gos = EnumAssets.EnumGameObjectRecursiveInCurrentSelection(); int i = 0; int processed = 0; int count = gos.Count(); { // foreach(var go in gos) var __enumerator2 = (gos).GetEnumerator(); while (__enumerator2.MoveNext()) { var go = __enumerator2.Current; { EditorUtility.DisplayProgressBar("Find Missing Script In Selection", go.name, i * 1.0f / count); i++; var cs = go.GetComponents <Component>(); foreach (var c in cs) { if (null != c) { continue; } str += AssetDatabase.GetAssetPath(go.GetInstanceID()); str += " [" + go.gameObject.transform.FullPath() + "]\n"; processed++; } } } } EditorUtility.ClearProgressBar(); if (!string.IsNullOrEmpty(str)) { Debug.Log(str); } Debug.Log("Find Missing Script Total=[" + processed.ToString() + "]---------------end"); return(true); }
///把除了带Animation的 带SceneAnimationTrigger 是SceneAnimationTrigger的Target 的perfab 都设成static public static void DrawcallOptimizemethod() { // GameObject[] gameObjects = EnumAssets.EnumGameObjectRecursiveInCurrentSelection() as GameObject[]; List <GameObject> staticList = new List <GameObject>(); int k = 0; { // foreach(var go in EnumAssets.EnumGameObjectRecursiveInCurrentSelection()) var __enumerator4 = (EnumAssets.EnumGameObjectRecursiveInCurrentSelection()).GetEnumerator(); while (__enumerator4.MoveNext()) { var go = __enumerator4.Current; { EditorUtility.DisplayProgressBar("Draw Call Optimize", go.name, k * 1.0f / EnumAssets.EnumGameObjectRecursiveInCurrentSelection().Count()); bool flag = false; do { if (null != go.GetComponent <Animation>()) { break; } if (null != go.GetComponent <SceneAnimationTrigger>()) { break; } if (null != go.GetComponent <ParticleSystem>()) { break; } if (null != go.GetComponent <ModelTextureAnimation>()) { break; } flag = true; } while (false); go.gameObject.isStatic = flag; if (go.GetComponent <SceneAnimationTrigger>()) { SceneAnimationTrigger ada = go.GetComponent <SceneAnimationTrigger>(); foreach (var d in ada.KeyFrames) { staticList.Add(d.Target); } } k++; } } } EditorUtility.ClearProgressBar(); { var __list5 = staticList; var __listCount5 = __list5.Count; for (int __i5 = 0; __i5 < __listCount5; ++__i5) { var a = __list5[__i5]; { a.isStatic = false; } } } AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); }
//去掉重复的mesh collider public static void RemoveSameMeshColliderInSelection() { RemoveSameMeshCollider(EnumAssets.EnumGameObjectRecursiveInCurrentSelection()); }