using System; using System.Collections.Generic; using Sirenix.OdinInspector; using UnityEngine; namespace UnityTest.ZXL { public class CameraManager : BaseAutoMono { public List cameras = new List(); public Camera current; private void Update() { current = GetCurrentCamera(); } public Camera GetCurrentCamera() { foreach (var camera1 in cameras) { if (camera1.gameObject.activeSelf) { return camera1; } } return null; } #if UNITY_EDITOR [Button] void Add(Transform timeline_M) { var list = timeline_M.gameObject.GetComponentAllChild(); cameras = list; } #endif } }