use the codes in 4.3 will show
An object reference is required to access non-static member `UnityEngine.Camera.fieldOfView’
So how to fix it and how to get/set field of view, thanks
use the codes in 4.3 will show
An object reference is required to access non-static member `UnityEngine.Camera.fieldOfView’
So how to fix it and how to get/set field of view, thanks
Here’s how to set the fieldOfView of the Main Camera (tagged “MainCamera”):
public void ChangeFieldOfView(float degrees)
{
Camera.main.fieldOfView = degrees;
}
Call the ChangeFieldOfView method and pass the new fieldOfView as an argument. Of course, you can just use anywhere in your code:
Camera.main.fieldOfView = 30f; // to set FOV to 30 degrees for example
If you don’t want to set the FOV for the main camera, please provide some details about which camera you want to do this. But generally, you must have a reference to the particular camera.