- Home /
How do I solve this error?
Whenever I try to make a PlayerController script, I keep getting the same error, which is:
(!) MissingReferenceException: The object of type 'Object' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.
I am getting this error even whilst I am using Unity's example code for learning how to use the system, such as their Roll A Ball tutorial. I'll follow the tutorial, and write the script exactly the same as they have it in the video, with every character being perfect, and following any added annotations, but yet it still doesn't work at all. Please help me.
That script is missing a closing }. But, as it's not trying to destroy any objects, it seems very unlikely to be the one causing the error message. Please post the complete error message here, complete with script name and line numbers.
Answer by iPoopLegos · Jul 12, 2016 at 01:22 PM
For some reason it fixed it's self in an earlier build of the game.
Answer by hamado · Jun 29, 2016 at 08:09 PM
Do you have a rigidbody component attached to the same object ?, I don't see any other reason you would get a null reference exception.
Do you have any other script communicating with this one?, otherwise you probably forgot to attach a rigidbody to the object.
Your answer
Follow this Question
Related Questions
How to move while jumping? 1 Answer
How do I create an Initial Spawn Point? 2 Answers
Multiple Cars not working 1 Answer
Disabling A Script on a GameObject From a Different Script 2 Answers