| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | public class SkyboxCameraBehaviour : MonoBehaviour |
| | 4 | | { |
| | 5 | | [SerializeField] private GameObject target; |
| | 6 | | private Camera cam; |
| | 7 | | private Camera targetCam; |
| | 8 | |
|
| | 9 | | private void LateUpdate() |
| | 10 | | { |
| 0 | 11 | | if (target == null) |
| | 12 | | { |
| 0 | 13 | | return; |
| | 14 | | } |
| | 15 | |
|
| 0 | 16 | | this.transform.position = target.transform.position; |
| 0 | 17 | | this.transform.rotation = target.transform.rotation; |
| 0 | 18 | | cam.fieldOfView = targetCam.fieldOfView; |
| 0 | 19 | | } |
| | 20 | |
|
| | 21 | | public void AssignCamera(Camera targetCamComponent, Camera skyboxCamera) |
| | 22 | | { |
| 0 | 23 | | target = targetCamComponent.gameObject; |
| 0 | 24 | | cam = skyboxCamera; |
| 0 | 25 | | targetCam = targetCamComponent; |
| 0 | 26 | | } |
| | 27 | | } |