E
E
elpaxte2018-09-26 20:14:10
3D
elpaxte, 2018-09-26 20:14:10

Unity: NullReferenceException: Object reference not set to an instance of an object PersonRotation.Update ( ) how to fix?

I wrote this code, used the camera from the standard asset of the unit, then decided to make my own, and made such a mistake, using the camera from the standard asset is not an option. I have some kind of buggy one. PersonRotation is the name of the script itself, and here it is, the error is somewhere on the 14th line. Please explain what is wrong and how to fix it.
5babbe2e0bda5573969716.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2018-09-26
@elpaxte

Do you know what "debugging an application" is? If you knew, you would have no problem finding out that Camera.main contains NULL. And the question would sound "how to mark the camera as the main one."
And all you need to do is select the "MainCamera" tag for the camera

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question