I have a script that’s supposed to change the XOffsset in my camera script. Here’s the code…
var aimX: float = 0.7;
var normalX: float = 0.8;
private var camera: Camera;
function Start(){
chMotor = GetComponent(CharacterMotor);
var ch:Camera = GetComponent(Camera);
}
function Update(){
var cameraX = normalX;
if (Input.GetButton("Aim")){
cameraX = aimX;
}
camera.MouseOrbitOTS.XOffest = cameraX;
}
But when I go into play mode, I get this error…
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[ ] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[ ] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Why am I getting this error? Its supposed to change the XOffset in my custom mouse orbit script from 0.8 to 0.7. If you have any questions, just ask.