- Home /
NullReferenceExeption help
Hi, everytime i place a ThirdPersonController on my person model i get a NullReferenceExeption message and i'm not sure why. This is the message: NullReferenceException
ThirdPersonController.UpdateSmoothedMovementDirection () (at Assets/Standard Assets/Character Controllers/Sources/Scripts/ThirdPersonController.js:105) ThirdPersonController.Update () (at Assets/Standard Assets/Character Controllers/Sources/Scripts/ThirdPersonController.js:320)
And this is the line of code that the error happens on:
var cameraTransform = Camera.main.transform;
Please help me
Answer by Mike 3 · Jan 16, 2011 at 03:16 PM
Camera.main is a property function which looks for the first active object with an enabled camera tagged as MainCamera. Make sure you have added the tag to a camera in your scene, and that it's enabled
Your answer
Follow this Question
Related Questions
Instantiate giving a NullReferenceError 1 Answer
NullReferenceException: Object reference not set to an instance of an object 2 Answers
MoveTowards doesn't work after changing tag. 2 Answers
NullPointerException while changing a variable from one script in another 1 Answer
array initialisation c# 1 Answer