Missing (Mono Script)

A common error when opening old projects is the Missing (Mono Script) error when attached components don’t show up.

Normally this is due to some compile time error in your project.

But I am getting this message with NO errors in my project!

How can I determine what this Missing script component is?

1 Like

I’m not an expert on the internal workings of Unity, but I believe each GameObject tracks the scripts it needs via a GUID that is stored in a script’s corresponding meta data (the *.cs.meta file).

That implies it does not track the script’s name or location. So if Unity can’t find the script, it can’t tell you what script it expected to find.

Presumably, any fields whose values have been set in the inspector would also need to be stored somewhere. My experiments with editing MonoBehaviours that are already used in the scene suggests that Unity stores those as key/value pairs using the field name. That implies those field names must exist somewhere, so maybe if the names are sufficiently recognizable you could guess the script from those. I couldn’t tell you how to find that list, though.

There’s also the option of “play the game and watch what breaks”.

1 Like

This can be tricky, but if it’s possible (like, you don’t have 10k objects to try and look through) then just go one by one and check each object and it’s children to see what script shows up in the inspector as missing (it won’t show the name) and remove it, and replace if needed with the proper script.

There are assets out there (some free) that claim to help hunt down these objects, but I didn’t have much luck using them.