I know this question has been asked before but looking at the answers I couldn’t understand what the issue is. Attached is the image of the code in question. I’m checking if something is null or not and that check is throwing a NullReference Exception.
Can someone help get rid of this error?
I believe that unity has a problem with finding that gameObject you are looking for, therefore it is not able to to chcek if it is null or not. Unity not knows which object to compare - so it throws NullReference Exception…
I guess, that
returns null. Consequently,
throws NullReference Exception.