using System.Collections.Generic; namespace UnityEngine.XR.Simulation { /// /// A component that can be used to tag a light for use in lighting estimation, for XR Simulation. /// [RequireComponent(typeof(Light))] [DisallowMultipleComponent] public class SimulatedLight : MonoBehaviour { [SerializeField, HideInInspector] Light m_SimulatedLight; /// /// The Light component that will be used in calculating light estimation. /// public Light simulatedLight => m_SimulatedLight; void Reset() => m_SimulatedLight = GetComponent(); void Awake() { if (m_SimulatedLight == null) { m_SimulatedLight = GetComponent(); } } void OnEnable() { if (SimulationUtils.IsInSimulationEnvironment(gameObject)) { SimulationSessionSubsystem.simulationSceneManager.TrackLight(this); } } void OnDisable() { if (SimulationUtils.IsInSimulationEnvironment(gameObject)) { SimulationSessionSubsystem.simulationSceneManager.UntrackLight(this); } } } }