using UnityEngine; namespace RND { public class CamerasResolutionCorrector : MonoBehaviour { [SerializeField] private Vector2 _defaultResolution = new Vector2(360f, 640f); [Range(0f, 1f)] public float _widthOrHeight = 0; [SerializeField] private bool _debug; private BaseCameraCorrector[] _correctors; private void Awake() { Camera camera = GetComponent(); _correctors = transform.parent.GetComponentsInChildren(true); foreach (BaseCameraCorrector corrector in _correctors) corrector.Init(camera, _defaultResolution); } private void OnEnable() { SyncFieldOfView(); } private void Update() { if (_debug == false) return; SyncFieldOfView(); } private void SyncFieldOfView() { foreach (BaseCameraCorrector data in _correctors) data.SyncCameraProperty(_widthOrHeight); } } }