HorizontalFovSetter.cs 413 B

123456789101112131415161718
  1. using UnityEngine;
  2. namespace SoftMasking.Samples {
  3. [RequireComponent(typeof(Camera))]
  4. public class HorizontalFovSetter : MonoBehaviour {
  5. public float horizontalFov;
  6. Camera _camera;
  7. public void Awake() {
  8. _camera = GetComponent<Camera>();
  9. }
  10. public void Update() {
  11. _camera.fieldOfView = horizontalFov / _camera.aspect;
  12. }
  13. }
  14. }