- Home /
How do find all meshes my Project?
Hey guys,
after importing the latest Version of our project, some of the meshes went missing. I found out that it had something to do with the naming of the meshes within the imported c4d file. (in this case I used a "+" in the name of some of the meshes and when Unity imported them, each "+" was renamed to "_" and went missing.)
Now to make sure the project is clean, I will have to find all the meshes that have a "+" within the mesh of their c4d-file, but since unity renamed them on import, I can't look for them by just searching for "+" in the project. Now alternatively, I could also find all the objects that have a "Mesh: Missing (Mesh)" in their "Mesh Filter" component. But since the project is really big by now, doing this manually would take forever. Is there a simple editor script that can go through the project and list every object with a missing mesh property?
Thanks a lot for your help guys!
Cheers Felix
Answer by robertbu · Aug 08, 2013 at 02:59 PM
I ran a quick test. This editor script will give you the name of any game object that has a missing mesh.
using UnityEngine;
using UnityEditor;
public class FindMissingMeshes : EditorWindow {
[MenuItem("Window/FindMissingMeshes")]
public static void ShowWindow() {
EditorWindow.GetWindow(typeof(FindMissingMeshes));
}
public void OnGUI() {
if (GUILayout.Button("Find Missing Meshes")) {
FindMissing();
}
}
private static void FindMissing() {
MeshFilter[] amf = (MeshFilter[])Resources.FindObjectsOfTypeAll(typeof(MeshFilter));
foreach (MeshFilter mf in amf) {
if (!AssetDatabase.Contains(mf.mesh))
Debug.Log ("Missing mesh on game object: "+mf.name);
}
}
}
Hey man! Thanks a bunch! This will help me big time!!
Cheers Felix
Your answer
![](https://koobas.hobune.stream/wayback/20220613111754im_/https://answers.unity.com/themes/thub/images/avi.jpg)