- Home /
C# - Mathf.Lerp: NullReferenceException: Object reference not set
Full error:
NullReferenceException: Object reference not set to an instance of an object MouseLook.FixedUpdate () (at Assets/MouseLook.cs:32)
I don't know if I did something stupid, but the line of code that doesn't work is:
transform.up = Vector3.Lerp (transform.up, transform.parent.up, 0.25f);
I am trying to set the main camera's position to the position of the player capsule, but it just keeps throwing that error. Any ideas?
$$anonymous$$ost likely transform.parent
is null. How is the object you try to move parented? And if you are trying to set a position, why are you modifying transform.up
?
$$anonymous$$ake sure your camera is a child of your player.
Answer by NoName115 · Apr 14, 2015 at 04:19 PM
Maybe is problem with modifying tranform.up, i am not really sure if it is posible. You could modify transform.position.
Your answer
Follow this Question
Related Questions
Unit rotation fails consistently on all slerp rotations after the first? 0 Answers
Move position with smoothing 0 Answers
Shrinking an Object 1 Answer
Distribute terrain in zones 3 Answers
Camera Lerp from A to B, and back 2 Answers