I have been completely stumped by this. I followed a tutorial for making a third person camera, with a lock-on system. The problem is I get these NullReferenceExceptions, and can’t get the camera to respond to mouse+keyboard or controller input. I am new to this so I can’t really think of how to fix this, despite spending many days trying to figure it out and rewatching the tutorial.
The problem lines are for the InputHandler, highlighted in the screencap. The first highlighted line is clearly where it goes wrong, but I don’t know how to fix it. The second file is the script that it uses info from.
A “reference” in this case is when you store a reference to an object in variable. “Null” means “nothing”. That’s a value given to an empty reference variable. A “Null reference exception” means that you are trying access members of an object from a reference variable, but there’s no object at all, instead there’s only “null”.
Did you notice in all three errors you are trying to reference the same object? That should give you a hint as to which object has the problem.
But why is it saying that this instance doesn’t exist? There’s transform information in it to be initialized, and it is in the scene with the scripts. I get where it’s messing up, and what the error means, but I don’t know how to fix it.