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