private static void CheckMaterialsByRoot(GameObject root) { if (root == null) { return; } Renderer[] render = root.GetComponentsInChildren <Renderer>(); string logStr = ""; foreach (Renderer r in render) { if (r is ParticleSystemRenderer) { continue; } logStr = CCheckTools.GetCompletePath(r.transform); if (SceneOrPrefab == 1) { logStr = "Scene:" + SceneManager.GetActiveScene().name + "->" + logStr; } if (r.sharedMaterials != null) { if (r.sharedMaterials.Length > 4) { countStr.Add(logStr + ":material count=" + r.sharedMaterials.Length); } if (MaterialsRepeat(r.sharedMaterials)) { repeatStr.Add(logStr + ":material repeat"); } } } }
public static void CheckColorByRoot(Transform root) { if (root == null) { return; } MeshFilter mf = root.GetComponent <MeshFilter>(); SkinnedMeshRenderer smr = root.GetComponent <SkinnedMeshRenderer>(); if (mf != null && mf.sharedMesh != null) { if (mf.sharedMesh.colors.Length > 0 || mf.sharedMesh.colors32.Length > 0) { string logStr = CCheckTools.GetCompletePath(root); CCheckTools.AddLogInfo(logStr); } } for (int i = 0; i < root.transform.childCount; i++) { CheckColorByRoot(root.transform.GetChild(i)); } }
public static void CheckUVByRoot(Transform root) { if (root == null) { return; } MeshFilter mf = root.GetComponent <MeshFilter>(); SkinnedMeshRenderer smr = root.GetComponent <SkinnedMeshRenderer>(); int count = 0; if (mf != null && mf.sharedMesh != null) { if (mf.sharedMesh.uv.Length > 0) { count++; } if (mf.sharedMesh.uv2.Length > 0) { count++; } if (mf.sharedMesh.uv3.Length > 0) { count++; } if (mf.sharedMesh.uv4.Length > 0) { count++; } if (mf.sharedMesh.uv5.Length > 0) { count++; } if (mf.sharedMesh.uv6.Length > 0) { count++; } if (mf.sharedMesh.uv7.Length > 0) { count++; } if (mf.sharedMesh.uv8.Length > 0) { count++; } } if (smr != null && smr.sharedMesh != null) { if (smr.sharedMesh.uv.Length > 0) { count++; } if (smr.sharedMesh.uv2.Length > 0) { count++; } if (smr.sharedMesh.uv3.Length > 0) { count++; } if (smr.sharedMesh.uv4.Length > 0) { count++; } if (smr.sharedMesh.uv5.Length > 0) { count++; } if (smr.sharedMesh.uv6.Length > 0) { count++; } if (smr.sharedMesh.uv7.Length > 0) { count++; } if (smr.sharedMesh.uv8.Length > 0) { count++; } } if (count >= 2) { string logStr = CCheckTools.GetCompletePath(root); CCheckTools.AddLogInfo(logStr + ":uv Count=" + count); } for (int i = 0; i < root.transform.childCount; i++) { CheckUVByRoot(root.transform.GetChild(i)); } }