- Home /
Script Giving Null Reference Exception???
Hey! Guys I'm a bit confused here and I don't know what exactly is happening here. But I got to ask it. I got a script which I have assigned to three different objects. It works fine in two of them but gives null reference exception for one of them. I've gone through the whole code.
What's more irritating is that, earlier it was showing null reference exception for all of them. But when I quit Unity and restarted it. It stopped showing the error for two of them but still stuck to one of them. I'm really getting frustrated. I think it might be problem of the unity editor. Don't know what to do. Any suggestion.
Null reference exeprion errors are given If there is a script trying to do something with a GameObject or componenrs that are not present or assigned in the editor and hey can also appear because of many different things. If we do not know the script you are having the problen with we cannot help as much.
It worked! I just deleted the copied the whole script. deleted the file and created a new c# script and pasted the same code there and it worked. WTF. but thanks guys anyways for the reply.
Your answer
![](https://koobas.hobune.stream/wayback/20220613154548im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
i just got unity and when i open the program i get a error saying transaction is invalid 2 Answers
Unity fails to recognize Maya models/Unity scenes 1 Answer
A node in a childnode? 1 Answer
Wall Issue 1 Answer
ASDAsdASDasdqweqw3edqwdQWDEqwedQWD 3 Answers