public override bool DoCheckHierarchy(string asset, params GameObject[] rootObjs) { bool result = true; List <string> list; if (this.resultInfo.ContainsKey(asset)) { list = this.resultInfo[asset]; } else { list = new List <string>(); } int num = 2500; try { for (int i = 0; i < rootObjs.Length; i++) { foreach (Renderer renderer in rootObjs[i].GetComponentsInChildren <Renderer>(true)) { int num2 = renderer.sharedMaterials.Length; MeshFilter component = renderer.GetComponent <MeshFilter>(); if (component && component.sharedMesh) { string text = ""; if (component.sharedMesh.vertexCount > 220) { text = text + "顶点数超标:" + component.sharedMesh.vertexCount; } if (GameObjectUtility.AreStaticEditorFlagsSet(renderer.gameObject.gameObject, StaticEditorFlags.LightmapStatic)) { text += "开了LightMap静态合批"; } if (!string.IsNullOrEmpty(text)) { for (int k = 0; k < num2; k++) { Material material = renderer.sharedMaterials[k]; if (material && material.renderQueue > num) { list.Add(CheckBase <KeyValuePair <string, List <string> >, Dictionary <string, List <string> > > .GetTransformPath(renderer.transform) + "--" + text); result = false; break; } } } } } } if (list.Count > 0) { this.resultInfo[asset] = list; } } catch { } return(result); }
public override bool DoCheckHierarchy(string asset, params GameObject[] rootObjs) { List <string> list = new List <string>(); foreach (GameObject gameObject in rootObjs) { if (gameObject.layer == CheckLayerMatch.matchLayer) { list.Add(CheckBase <KeyValuePair <string, List <string> >, Dictionary <string, List <string> > > .GetTransformPath(gameObject.transform)); } foreach (object obj in gameObject.transform) { Transform transform = (Transform)obj; if (transform.gameObject.layer == CheckLayerMatch.matchLayer) { list.Add(CheckBase <KeyValuePair <string, List <string> >, Dictionary <string, List <string> > > .GetTransformPath(transform)); } } } if (list.Count > 0) { this.resultInfo.Add(asset, list); return(false); } return(true); }
public override bool DoCheckHierarchy(string asset, params GameObject[] rootObjs) { List <Collider> list = new List <Collider>(); List <string> list2 = new List <string>(); foreach (GameObject gameObject in rootObjs) { list.AddRange(gameObject.GetComponentsInChildren <Collider>(false)); } int num = 0; int num2 = 0; foreach (Collider collider in list) { if (this.GetMeshTriangles(collider, ref num, ref num2) && num2 >= 20) { float num3 = (float)num2 / (float)num; if (num3 > 0.1f) { string transformPath = CheckBase <KeyValuePair <string, List <string> >, Dictionary <string, List <string> > > .GetTransformPath(collider.transform); string str = string.Format("{0}/{1} : {2:P}", num2, num, num3); list2.Add(transformPath + " " + str); } } } if (list2.Count > 0) { this.resultInfo.Add(asset, list2); return(false); } return(true); }
public override bool DoCheckHierarchy(string asset, params GameObject[] rootObjs) { List <MeshCollider> list = new List <MeshCollider>(); List <string> list2 = new List <string>(); for (int i = 0; i < rootObjs.Length; i++) { MeshCollider[] componentsInChildren = rootObjs[i].GetComponentsInChildren <MeshCollider>(true); list.AddRange(componentsInChildren); } foreach (MeshCollider meshCollider in list) { MeshFilter component = meshCollider.GetComponent <MeshFilter>(); if (component && component.sharedMesh) { string assetPath = AssetDatabase.GetAssetPath(meshCollider.sharedMesh); string assetPath2 = AssetDatabase.GetAssetPath(component.sharedMesh); if (assetPath == assetPath2) { list2.Add(CheckBase <KeyValuePair <string, List <string> >, Dictionary <string, List <string> > > .GetTransformPath(component.transform)); } } } if (list2.Count > 0) { this.resultInfo.Add(asset, list2); return(false); } return(true); }
public static string GetTransformPath(Transform t) { if (t.parent == null) { return(t.name); } return(string.Format("{0}/{1}", CheckBase <I, C> .GetTransformPath(t.parent), t.name)); }
private List <string> Traval(Transform t) { List <string> list = new List <string>(); Component[] components = t.GetComponents <Component>(); for (int i = 0; i < components.Length; i++) { if (components[i] == null) { list.Add(CheckBase <KeyValuePair <string, List <string> >, Dictionary <string, List <string> > > .GetTransformPath(t)); } } for (int j = 0; j < t.childCount; j++) { list.AddRange(this.Traval(t.GetChild(j))); } return(list); }
public override bool DoCheckHierarchy(string asset, params GameObject[] rootObjs) { bool result = true; List <string> list; if (this.resultInfo.ContainsKey(asset)) { list = this.resultInfo[asset]; } else { list = new List <string>(); } for (int i = 0; i < rootObjs.Length; i++) { foreach (Component component in rootObjs[i].GetComponentsInChildren <Component>(true)) { if (component is Renderer) { Renderer renderer = component as Renderer; int num = renderer.sharedMaterials.Length; int num2 = 0; while (num2 < num && (!(renderer is ParticleSystemRenderer) || num2 <= 0)) { if (string.IsNullOrEmpty(AssetDatabase.GetAssetPath(renderer.sharedMaterials[num2]))) { result = false; list.Add(CheckBase <KeyValuePair <string, List <string> >, Dictionary <string, List <string> > > .GetTransformPath(component.transform)); } num2++; } } } } if (list.Count > 0) { this.resultInfo[asset] = list; } return(result); }
public override bool DoCheckHierarchy(string asset, params GameObject[] rootObjs) { List <Collider> list = new List <Collider>(); List <string> list2 = new List <string>(); foreach (GameObject gameObject in rootObjs) { list.AddRange(gameObject.GetComponentsInChildren <Collider>(false)); } foreach (Collider collider in list) { if (!this.CheckColliderHiearchy(collider)) { list2.Add(CheckBase <KeyValuePair <string, List <string> >, Dictionary <string, List <string> > > .GetTransformPath(collider.transform)); } } if (list2.Count > 0) { this.resultInfo.Add(asset, list2); return(false); } return(true); }
public override bool DoCheckHierarchy(string asset, params GameObject[] rootObjs) { bool result = true; List <string> list = new List <string>(); foreach (GameObject gameObject in rootObjs) { Camera[] componentsInChildren = gameObject.GetComponentsInChildren <Camera>(); for (int j = 0; j < componentsInChildren.Length; j++) { if (componentsInChildren[j].enabled) { list.Add(CheckBase <KeyValuePair <string, List <string> >, Dictionary <string, List <string> > > .GetTransformPath(gameObject.transform)); result = false; } } } if (list.Count > 0) { this.resultInfo.Add(asset, list); } return(result); }