0
\$\begingroup\$

I have a couple objects that are throwing errors in the warning log:

The referenced script on this Behaviour (Game Object 'myObject') is missing!

Here is what they look like in the inspector:

enter image description here

How can I see what script is (or was) associated?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

You can't. Scripts in Unity are linked by unique ID, and in this case you have no script connected to that UID.

This can happen if you copied & pasted scene/script files without their associated .meta files, which are where Unity stores this UID association. These files are hidden by default, making them easy to miss when organising your project outside of Unity. When Unity sees a script file with no .meta file, it generates a new one with a new UID.

This can also happen if you're working on a shared project and have not configured your version control system to handle metadata files correctly. Each user on your project ends up with their own UIDs for new files, which don't match up to everyone else's.

If you need to investigate this forensically, try going back to the source of any files you recently imported or synched to your project, or to your last working version. Find what script is associated with that UID in this source/working version, and change the UID in your current version to match. The .meta files are plain text, so a regular text editor will do the trick here.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ So having .meta in .gitignore was bad... :( \$\endgroup\$ Jan 22, 2018 at 17:56
  • 2
    \$\begingroup\$ Yes indeed. Try looking up a guide on configuring Git for Unity to avoid this and other common pitfalls. \$\endgroup\$
    – DMGregory
    Jan 22, 2018 at 17:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .