NullReferenceException on second line but not first?

Hi, I’m running this code:

function Update () { if (Active){ transform.rotation = Quaternion.Slerp(transform.rotation, Target.rotation, Time.deltaTime * Smooth); transform.location = Vector3.Slerp(transform.location, Target.location, Time.deltaTime * Smooth); } }

I get a NullReferenceException on the second line (transform.location…) but not the first (transform.rotation…). Why? Why am I getting an exception at all, the lines are basically identical?

Also, this site is crap. Third time I’m retyping this post trying to get it to submit.

You want to use transform.position instead. That’s all. :slight_smile:

…unless there’s actually a transform.location.