public void Find() { string log = ""; if (null != Atlas) { log = LogSpriteName(Atlas); Debug.Log(log); return; } EditorUtility.DisplayProgressBar("Export Atlas Sprite Name", "loading...", 0); var gos = EnumAssets.EnumAssetAtPath <GameObject>("Assets/Res"); foreach (var go in gos) { EditorUtility.DisplayProgressBar("Export Atlas Sprite Name", go.name, 0); var atlas = go.GetComponent <UIAtlas>(); if (null != atlas) { log += LogSpriteName(atlas); } } EditorUtility.ClearProgressBar(); Debug.Log(log); }
public static void DeleteSpriteRenderer() { const string assetPath = "Assets/Res/UI"; DeleteSpriteRenderer( EnumAssets.EnumAllComponentDependenciesRecursive <SpriteRenderer>( EnumAssets.EnumAssetAtPath <UnityEngine.Object>(assetPath))); }
//优化资源 public static void OptimizingScenePrefab() { const string ASSET_PATH = "Assets/Res/Scene"; RemoveSameMeshColliderComponent.RemoveSameMeshColliderInEnumAssetAtPath(EnumAssets.EnumAssetAtPath <UnityEngine.Object>(ASSET_PATH)); ShadowsCloseTools.CloseShadows(EnumAssets.EnumAllComponentDependenciesRecursive <Renderer>(EnumAssets.EnumAssetAtPath <UnityEngine.Object>(ASSET_PATH))); //AnimationClipTool.ChangeAnimatorToAnimationInPath(ASSET_PATH); T4MComponentDisable.T4MComponentDisablemethod(EnumAssets.EnumAllComponentDependenciesRecursive <T4MObjSC>(EnumAssets.EnumAssetAtPath <UnityEngine.Object>(ASSET_PATH))); DrawcallOptimize.DrawcallOptimizemethod(ASSET_PATH); }
public static bool ChangeAnimatorToAnimationInPath(string ASSET_PATH) { EditorUtility.DisplayProgressBar("Change Animator to Animation in Path", "Collecting MeshRenderer Components", 0); string str = ""; Debug.Log("ChangeAnimatorToAnimation----------------begin"); int i = 0; var gos = EnumAssets.EnumAllComponentDependenciesRecursive <Animator>( EnumAssets.EnumAssetAtPath <UnityEngine.Object>(ASSET_PATH)); int total = 0; { // foreach(var c in gos) var __enumerator3 = (gos).GetEnumerator(); while (__enumerator3.MoveNext()) { var c = __enumerator3.Current; { total++; } } } { // foreach(var go in gos) var __enumerator4 = (gos).GetEnumerator(); while (__enumerator4.MoveNext()) { var go = __enumerator4.Current; { EditorUtility.DisplayProgressBar("Change Animator to Animation in Path", go.gameObject.name, i * 1.0f / total); var g = go.gameObject; AnimationOptimizing(go); str += "[" + g.transform.FullPath() + "]\n"; i++; } } } EditorUtility.ClearProgressBar(); if (!string.IsNullOrEmpty(str)) { Debug.Log(str); } AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); Debug.Log("ChangeAnimatorToAnimation-Total=[" + i.ToString() + "]---------------end"); return(true); }
//优化资源 public static void OptimizingResDirectory() { const string ASSET_PATH = "Assets/Res"; ShadowsCloseTools.CloseShadows(EnumAssets.EnumComponentRecursiveAtPath <Renderer>(ASSET_PATH + "/Model")); OptimizingPropertiesOfModelResources.ResetObjectModelProperties(EnumAssets.EnumAssetAtPath <UnityEngine.Object>(ASSET_PATH + "/Model")); OptimizingPropertiesOfModelResources.ResetObjectModelProperties(EnumAssets.EnumAssetAtPath <UnityEngine.Object>(ASSET_PATH + "/Scene")); OptimizeTextureProperty.ResetTextureProperty(EnumAssets.EnumAssetAtPath <UnityEngine.Object>(ASSET_PATH + "/Model")); OptimizeTextureProperty.ResetTextureProperty(EnumAssets.EnumAssetAtPath <UnityEngine.Object>(ASSET_PATH + "/Effect")); //AnimationClipTool.ChangeAnimatorToAnimation(); //T4MComponentDisable.T4MComponentDisablemethod(); }
public static bool DrawcallOptimizemethod(string ASSET_PATH) { EditorUtility.DisplayProgressBar("DrawcallOptimizemethod in Path", "Collecting Object ", 0); string str = ""; Debug.Log("DrawcallOptimizemethod----------------begin"); int i = 0; var gos = EnumAssets.EnumAllGameObjectDependenciesRecursive( EnumAssets.EnumAssetAtPath <UnityEngine.Object>(ASSET_PATH)); int total = 0; List <GameObject> staticList = new List <GameObject>(); int k = 0; { // foreach(var c in gos) var __enumerator6 = (gos).GetEnumerator(); while (__enumerator6.MoveNext()) { var c = __enumerator6.Current; { total++; } } } { // foreach(var go in gos) var __enumerator8 = (gos).GetEnumerator(); while (__enumerator8.MoveNext()) { var go = __enumerator8.Current; { // GameObject[] gameObjects = EnumAssets.EnumGameObjectRecursiveInCurrentSelection() as GameObject[]; EditorUtility.DisplayProgressBar("Draw Call Optimize", go.name, k * 1.0f / total); 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); str += go.name + "\n"; } } k++; } } } EditorUtility.ClearProgressBar(); if (!string.IsNullOrEmpty(str)) { Debug.Log(str); } { var __list9 = staticList; var __listCount9 = __list9.Count; for (int __i9 = 0; __i9 < __listCount9; ++__i9) { var a = __list9[__i9]; { a.isStatic = false; } } } AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); Debug.Log("DrawcallOptimizemethod-Total=[" + i.ToString() + "]---------------end"); return(true); }