Camera FOV is adjustable in editor but not in Android Phone build (Google VR 1.6 and Unity 5.6.1f1)
I found a C# Script that allows me to change the FOV of the camera in-game, it works well in the editor but when I play it on my Android phone it doesn't work anymore. Did anyone get the same problems? Thanks for the help!
here is the code
using UnityEngine; using System.Collections;
public class CameraZoom : MonoBehaviour { // public Camera caml; public float zoomSpeed = 20f; public float minZoomFOV = 10f; public float maxZoomFOV = 60f; public bool zoomedIn = false; //boolean that determines whether we are in zoomed in state or not void Update () { if (Input.GetButtonDown ("Fire3")) {//(Input.GetKeyDown("z"))//This function toggles zoom capabilities with the Z key. If it's zoomed in, it will zoom out
zoomedIn = !zoomedIn;
}
if (zoomedIn == true) {
caml.fieldOfView -= zoomSpeed/8;
//Camera.main.fieldOfView -= zoomSpeed/8;
if (caml.fieldOfView < minZoomFOV)
{
caml.fieldOfView = minZoomFOV;
}
}
else
{
caml.fieldOfView = maxZoomFOV;
}
}
public void ZoomIn()
{
caml.fieldOfView -= zoomSpeed/8;
if (caml.fieldOfView < minZoomFOV)
{
caml.fieldOfView = minZoomFOV;
}
}
}
Your answer
Follow this Question
Related Questions
GearVR camera shaking/Jittering 1 Answer
AndroidManifest-main.xml merging error 6 Answers
Help with google vr for android api 0 Answers