NullReferenceException. Details included.

Here’s this error I have after dragging an object (parented to Main Camera) into the variable slot of another object’s script (Also parented to Main Camera).

Error:

NullReferenceException
UnityEditor.HandleUtility+SavedCamera..ctor (UnityEngine.Camera source)

Detailed error:

System.NullReferenceException: 
  at <0x00000> <unknown method>
  at (wrapper managed-to-native) UnityEngine.Camera:get_nearClipPlane ()
  at UnityEditor.HandleUtility+SavedCamera..ctor (UnityEngine.Camera source) [0x00000] 
  at UnityEditor.HandleUtility.PushCamera (UnityEngine.Camera camera) [0x00000] 
  at UnityEditor.SceneViewRotation.OnGUI () [0x00000] 
  at UnityEditor.SceneView.OnGUI () [0x00000] 
  at <0x00000> <unknown method>
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]

Any help would be awesome,

Kyle

You’re trying to access a member of a variable that isn’t initialized.

What are the scripts doing / post some code from around where that object gets used?

In my script “LeftArmAnims”, The only code I have is:

var grabber: Grabber;
//and farther down
if(grabber.animState == 2)
{
leftArmState = LeftArmState.idle;
}

The script that I drag into the grabber variable slot is “Grabber”, I’m trying to detect when animState changes, and play the corresponding animation in my LeftArmAnims script.

var animState = 0;
//farther down:
if(something happens)
{
aminState = 2;
}

I’m going to be doing a lot of tweaking but I need to be able to detect that variable first.

Now, I read this: http://answers.unity3d.com/questions/8232/what-is-a-null-reference-camera-error-exception

I am dragging Grabber (a child of Main Camera) into the variable slot of LeftArmAnims (Also a child of Main Camera), I really hope this isn’t the problem >.<