Hi all,
Since the solutions I was able to find didn’t really suit my needs, I’ve made a script that can:
- Find all missing script objects in the selected scene
- Find all missing script objects in your assets
It will provide you with a nice GUI, in which you can click on all of the search results and it will highlight the object in question for you. I was also able to make a script that goes through all of the scenes, and although it works it involves a lot of virtual scenes, opening closing scenes and such, which I think may scare too many people off. But let me know if I should include that as well.
12 Likes
Thank you, it was very useful!
Good work,
I use this code to delete all missing scripts in the scene.
[MenuItem("Tools/Find missing scripts/DeleteAll")]
static void FindAndDeleteMissingScripts()
{
foreach (GameObject gameObject in GameObject.FindObjectsOfType<GameObject>())
{
foreach (Component component in gameObject.GetComponentsInChildren<Component>())
{
if (component == null)
{
GameObjectUtility.RemoveMonoBehavioursWithMissingScript(gameObject);
break;
}
}
}
}
Right now I don’t have time to adapt the code of the script made by singelsnick. So you can see how automatic deletion works and add to the code as you wish, where you want and how you want.
1 Like
thanks a lot
a few tweaks:
- survive domain reload
- remove deleted gameobjects from list
- exclude prefabs in packages
9886464–1426701–MissingScriptWindow.cs (4.15 KB)
3 Likes