I am trying to fix errors in one of the scripts I transfered from Unity 4 to Unity 5:
Here it is:
public var FOVIN : float = 35;
public var FOVSpeed : float = 5;
public var Aim : boolean = false;
public var DeffFOV : float;
public var Cam : Camera;
function Start(){
DeffFOV = GetComponent.Camera.fieldOfView;
}
function Update () {
if( Input.GetMouseButtonDown(1)){
Aim = true;
}
if( Input.GetMouseButtonUp(1)){
Aim = false;
}
if( Aim){
GetComponent.Camera.fieldOfView = Mathf.Lerp( GetComponent.Camera.fieldOfView, FOVIN, FOVSpeed * Time.deltaTime);
}
if( !Aim){
GetComponent.Camera.fieldOfView = Mathf.Lerp( GetComponent.Camera.fieldOfView, DeffFOV, FOVSpeed * Time.deltaTime);
}
}
Its giving me problems with Camera part ,I am not sure I am using the “get component” right here ,I tryed the “GetComponent().fieldOfView” but it still gave errors ,this way I posted up in the code part lets me get into game mode but I get null reference error… Help pls