The referenced script (Unknown) on this Behaviour is missing!

I did some large-scale cleanup and might have deleted a script that is still referenced somewhere I can’t find. At runtime I’m getting hundreds of these warnings: “The referenced script (Unknown) on this Behaviour is missing!”

They contain NO IDENTIFYING INFORMATION. No stack trace. Clicking on them does not take me to the behavior in question, possibly because it has already been destroyed.

I’ve tried searching all my scenes and prefabs using this script:

But it either can’t find missing Components, or the problem isn’t as obvious as I thought.

None of the suggestions in this StackOverflow post have helped me find the cause:
https://stackoverflow.com/questions/54969972/unity-the-referenced-script-unknown-on-this-behaviour-is-missing

SUGGESTION to Unity: please improve this warning by at least including the name of the Behaviour in question, or better yet its full path in the scene. Even better: make including the name of the thing that is broken a Unity platform standard for all warning messages. Unity has too many generic warnings that are incredibly difficult to track down because they lack any identifying data.

4 Likes

I’m sorry you’ve had this issue. Please consider using source control in order to guard and protect your hard-earned work.

Personally I use git because it is free and there are tons of tutorials out there to help you set it up.

As far as configuring Unity to play nice with git, keep this in mind:

Here’s how I use git in one of my games, Jetpack Kurt:

Using fine-grained source control as you work to refine your engineering:

Share/Sharing source code between projects:

Setting up the right .gitignore file:

Some specific info about Missing script warnings, GUIDs, renaming GUIDs, etc:

I run a Subversion server on AWS and agree that developing without source control is a super dumb idea. I wrote a how-to guide about it in 2014 that is very out of date, but I have no regrets and still prefer SVN to GIT.

It’s a good thing I had it, because the way I fixed this was:

  • restoring all recently deleted components one at a time until the error stopped

  • copying the guid from that component’s .meta file.

  • doing a raw text search for the guid in all *.prefab files (also *.scene and *.asset)

This requires Project Settings > Editor > Asset Serialization > Mode = Force Text.

But my suggestion to Unity stands and I strongly feel there should be a better way to find the source of any warning Unity logs.

2 Likes