- Home /
The referenced script on this Behaviour is missing! non-existant GameObject
I was testing out a gameobject I created that, among other things, would destroy any other gameobject that touched it that used the interface, "Resource." shortly after I allowed it to destroy a test object, my console was spammed with "The referenced script on this Behaviour is missing!" however, when I double-click the error in console, on the inspector bar, it would show a non existant gameobject. It had no name, and the only attached component was a Script, called "None (Mono Script)." this non existant gameobject cannot be located anywhere in the scene, and only seems to exist when I double-click the error in console. any ideas as to what the heck could be going on?
Edit/Followup: I fixed this issue, or more accurately, it got fixed and I don't know why. however, I am still getting the same warning/ghost gameobject for other reasons as well. for instance, My game locks and hides the cursor using Cursor.lockState, and the lock can be temporarily removed by holding left control. However, sometimes if I tab out of then back into the unity editor, the cursor will be visible, but stuck in the center of the game window. If I attempt to move the cursor while this is happening, it teleports back to the center of the window. All the while, the console is spamming "The referenced script on this behaviour is missing!" In order to unstick it, I can either left click, or press left control. any idea what could possibly be causing this?
No way to be sure but, you probably destroyed the Script and not the gameObject, note if you do this: Destroy(Character) ins$$anonymous$$d of Destroy(Character.gameObject) you will destroy only the Script Character attached to the gameObject not the gameObject itself.