namespace UnityEngine.XR.ARSubsystems { /// /// Serves as the base class for all the /// [subsystems](https://docs.unity3d.com/ScriptReference/Subsystem.html) /// in this package. /// /// The /// [Subsystem Descriptor](https://docs.unity3d.com/ScriptReference/SubsystemDescriptor.html) /// for the /// [Subsystem](https://docs.unity3d.com/ScriptReference/Subsystem.html). /// public abstract class XRSubsystem : Subsystem where TSubsystemDescriptor : ISubsystemDescriptor { /// /// Invoked when is called and is false. /// protected abstract void OnStart(); /// /// Invoked when is called and is true. /// protected abstract void OnStop(); /// /// Invoked when [Destroy](https://docs.unity3d.com/ScriptReference/Subsystem.Destroy.html) /// is called. This method will not be invoked more than once, even if Destroy is /// called multiple times. /// protected abstract void OnDestroyed(); /// /// true if the Subsystem has been Started and is currently running, /// otherwise false. /// public sealed override bool running => m_Running; bool m_Running; /// /// Destroys the [subsystem](https://docs.unity3d.com/ScriptReference/Subsystem.html). /// If the subsystem is , is also called. /// protected sealed override void OnDestroy() { Stop(); OnDestroyed(); } /// /// Starts the [subsystem](https://docs.unity3d.com/ScriptReference/Subsystem.html). /// public sealed override void Start() { if (!m_Running) { OnStart(); } m_Running = true; } /// /// Stops the [subsystem](https://docs.unity3d.com/ScriptReference/Subsystem.html). /// public sealed override void Stop() { if (m_Running) { OnStop(); } m_Running = false; } } }