UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"zoom the camera at runtime using mouse click"
public class CameraZoom : MonoBehaviour { public Camera camera; public float defaultFieldOfView = 60; void Update() { if (Input.GetMouseButton(1)) { camera.fieldOfView = defaultFieldOfView / 2); } else { camera.fieldOfView = (defaultFieldOfView); } } }