[SOLVED] The Referenced Script On This Behaviour Is Missing

I have a Game Object where I store a prefab and a script to use on a GUI button. Basically, you click on the button and the script instantiates a clone of the prefab (and another function that destroy such clone). The script works fine but Unity keeps giving me these error messages:

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

Again, the game works and runs perfectly, the script just as much, but these messages are starting to bother me. Here's a sample of my script:

public class BuildMenu : MonoBehaviour
    public GameObject tower;
    public bool towerTrigger;
    public Transform tPosition;
    GameObject towerClone;

    void Start()
        towerTrigger = true;

    public void TowerSpawn()
        if (towerTrigger)
        towerClone = Instantiate(tower, tPosition.position, tPosition.rotation) as GameObject;
        towerTrigger = false;
        Debug.Log("Tower Created");
    public void TowerDestroy()
        if (!towerTrigger)
            Debug.Log("There's already a tower here");
            towerTrigger = true;

The object where the script is stored is being used in the GUI button on the Mouse Down () void.

SOLUTION = I had created a script and attached it to the prefab but later on erased it, so Unity was telling me that this script (outside from the one posted in the thread) was missing. Noob mistake.




thanks man i was scratching my head about this all night.

1 Like

Hey, man, the only thing I would think about changing is the GameObject.Find, since everyone around the forum say the function sucks. Maybe use the tag of the collider it is hitting seems like a better strategy? Hope it helps.

I got a lot of “The referenced script on this Behaviour (Game Object ‘’) is missing!” (note the ) warnings and couldn’t find it with any “FindMissingReference” script and paid tools from the asset store in the scene or prefabs. Apparently the problem was a corrupt scene file. Solution: Create a new scene, load it into the bogus scene and copy all objects. You should also check the references of the scripts and UI input handling. Some references were lost in copyation and I had to remove and readd the EventSystem :eyes:.


Thank you a thousand times over for this! I had just about given up hope. I knew what removed script was causing the issue, and bringing it back removed the warning. I was certain there were no references to it in my project. I stumbled upon this, created a new scene, copied the contents across and sure enough the warnings are gone!


I’m glad it helped. However I’m still seeing some warnings every now and then, so it didn’t fix it completely.


Thanks a lot for the update, I know this is a bit late but u saved me so much time I was head over heels trying to figure out whats wrong :stuck_out_tongue:

Hi @all

I found this post by search a solution for my issue maybe someone can help me i search for months!!! ^^

Its a livestream problem with my oculus rift into the facebook spaces app, when i go live the stream stops and give me a error text dat

its look like that

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

The referenced script on this Behaviour (Game Object ‘’) is missing!

(Filename: Line: 1744)

Thanks you so much for helping

best regards


Bump. I just experienced this problem and, in my case, it was pretty easy to fix..

The referenced script on this Behaviour (Game Object 'LineUp') is missing!
The referenced script on this Behaviour ('Unknown') is missing!
The referenced script on this Behaviour (Game Object 'LineDown') is missing!
The referenced script on this Behaviour ('Unknown') is missing!

I had created two game objects, each to hold a line renderer. I then created a script to work with them and attached it to the each game object.

I later deleted this script in Visual Studio (not removing it from the LineUp gameobject in the Unity Editor by right clicking and choosing remove component) as the script was just for testing. This caused the problem in the two game objects (each missing the deleted script) and I had the above set of annoying and stressful messages.

Of course, I made many changes to the project before I noticed the issue. Took me a bit to find this post. Best to stop and fix those issues!

So, i think the errors were caused by deleting the script in Visual Studio without removing the script component in the Unity Editor first. Down at the bottom of each offending gameobject’s component list, you will see a script is attached with no name, it just says SCRIPT (I.e., no script name)

The fix for me was to create a new empty game object, copy the linerenderer component from the old one to the new one and then go back and delete the offending old game object. Renamed the new one to the same name as before and the problem was solved.

Hopefully a similar fix will work for others...

Good luck


I don’t get this at all! I removed the tools I was using and every script file from the prefabs in the scene and it still gives the error messages pointing me to the prefabs but the prefabs have nothing on them and everything works fine when I hit play.


Wouldn't it be great if Unity saved the name of the script that was attached, so when it disappeared you had a chance of figuring out what was there so you could fix it? Apparently this is not enough to jog my memory: 4470847--410758--upload_2019-4-25_16-17-13.png

Does anyone have a good suggestion for how to keep track of which script components are attached to which GameObjects? For me, they usually get broken during a Unity upgrade or in a Git merge of YAML files, and when the problem is discovered, I often can't remember what script was attached.


+1. It would be helpful…

  • If the asset Guid was included in the message, if available…

  • A ‘find missing/broken references in assets/objects’ tool was built-in.

  • SerializedProperty was changed such that we can no longer easily detect broken references. That needs to be improved - not deprecated. I have a cobbled together missing references tool that (gulp) cracks asset YAML and tries to match things up. It’s quite ugly and barely works only for some things.

  • thanks


Copying scene content to a new scene
removed the warnings.

1 Like

Copying old scene content to a new scene, the warnings went away when playing the new scene. Strangely enough, it also removed the warnings of the old scene, so the warnings went away when playing the old scene. I think it's a Unity bug.

1 Like

I had 1646 fake Missing script warnings after upgrading the project from 2017.3 to 2018.4. It was object in scene that never had a single script attached sometimes, so obviously just a bug. They had a hidden flag set to 2 in the meta files, setting that to 0 they became visible but i could only remove them by hand.
After days of pain, i managed to find this How do I Remove null components ( i.e. "Missing(Mono Script)" ) via editor script? - Questions & Answers - Unity Discussions and after upgrading to 2019.2 it worked and they were all gone.
I have 4 left, 2 per scene. Appearing only at runtime and belonging to unexisting objects. Double clicking the warning opens up in the inspector a prefab that doesn’t exist anymore in the project, with 2 missing scripts.
The IDs don’t exist in the meta files.
Spooky. Anyone had anything like that?

Ran into a similar issue where I was getting this error for an object that didn’t appear in the hierarchy. Deleted all objects and was still getting the error. Turns out that there were hidden objects in the scene! I followed the suggestion linked below, installed the editor script, and was able to track down and remove the game object:

1 Like

Well, in my case, copying the scene content to another scene did NOT solve the problem. What I did though, was to find the GameObject that was missing the script (when you click on the warning message it highlights the problematic GameObject in the hierarchy) and noticed that it had a Script component that had an empty reference to a script. I removed that Script component and everything went back to normal ;).
This might save time and help someone, and this is the only reason I’m writing this post…

1 Like

So, I also stumbled into this too and nothing in the thread solved it, so here goes:

The root cause was that some references in the scene were missing, due to scripts not being present because the assembly they were part of was not marked as supported for the platform I was building for (UWP).

There was no build time warning at all, which puzzles me.

After marking the .asmdef as supporting UWP the errors were gone.

1 Like