Just an error @ js MouseLook

the Error is:
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
MouseLookjs.Update () (at Assets/Scripte/MouseLookjs.js:31)

the Code is:

	enum RotationAxes { MouseXAndY, MouseX, MouseY};
	var axes = RotationAxes.MouseXAndY;
	var sensitivityX = 15;
	var sensitivityY = 15;

	var minimumX = -60;
	var maximumX = 60;

	var minimumY = -4;
	var maximumY = 4;

	var rotationX = 0;
	var rotationY = 0;
	
	var originalRotation;

	function Update ( )
	{
		if (axes == RotationAxes.MouseXAndY)
		{
			// Read the mouse input axis
			rotationX += Input.GetAxis("Mouse X") * sensitivityX;
			rotationY += Input.GetAxis("Mouse Y") * sensitivityY;

			rotationX = ClampAngle (rotationX, minimumX, maximumX);
			rotationY = ClampAngle (rotationY, minimumY, maximumY);
			
			var xQuaternion : Quaternion = Quaternion.AngleAxis (rotationX, Vector3.up);
			var yQuaternion : Quaternion = Quaternion.AngleAxis (rotationY, Vector3.left);
			
			transform.localRotation = originalRotation * xQuaternion * yQuaternion;
		}
		else if (axes == RotationAxes.MouseX)
		{
			rotationX += Input.GetAxis("Mouse X") * sensitivityX;
			rotationX = ClampAngle (rotationX, minimumX, maximumX);

			xQuaternion = Quaternion.AngleAxis (rotationX, Vector3.up);
			transform.localRotation = originalRotation * xQuaternion;
		}
		else
		{
			rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
			rotationY = ClampAngle (rotationY, minimumY, maximumY);

			yQuaternion = Quaternion.AngleAxis (rotationY, Vector3.left);
			transform.localRotation = originalRotation * yQuaternion;
		}
	}
	
	function Start ()
	{
		// Make the rigid body not change rotation
		if (rigidbody)
			rigidbody.freezeRotation = true;
		originalRotation = transform.localRotation;
	}
	
	function ClampAngle (angle : float, min : float, max : float)
	{
		if (angle < -360)
			angle += 360;
		if (angle > 360)
			angle -= 36;
		return Mathf.Clamp (angle, min, max);
	}

thank you :slight_smile:

What does it mean? :?

Put “print” calls throughout the code to find out exactly where the error is (that is, where it stops printing your statements). It means that you tried to access a property or call a function on a null object. For example, if I have an object, I can normally call ToString() on it. But if that object is null, it would throw an error:

object obj = new object();
object nullObj = null;
print(obj.ToString()); //works
print(nullObj.ToString()); //throws the null reference exception