using System; using UnityEngine; namespace Unity.Tutorials.Core.Editor { /// /// Used to refer Unity Objects in different Criterion implementations. /// [Serializable] public class ObjectReference { [SerializeField] SceneObjectReference m_SceneObjectReference; [SerializeField] FutureObjectReference m_FutureObjectReference = default; /// /// Is this ObjectReference a FutureObjectReference instead of a SceneObjectReference;. /// public bool IsFutureReference => m_FutureObjectReference != null; /// /// The SceneObjectReference. /// public SceneObjectReference SceneObjectReference { get { if (IsFutureReference) return m_FutureObjectReference.SceneObjectReference; return m_SceneObjectReference ?? (m_SceneObjectReference = new SceneObjectReference()); } set { if (!IsFutureReference) m_SceneObjectReference = value; } } } }