Class XRManagerSettings
Class to handle active loader and subsystem management for XR SDK. This class is to be added as a component on a GameObject in your scene. Given a list of loaders, it will attempt to load each loader in the given order. The first loader that is successful wins and all remaining loaders are ignored. The loader that succeeds is accessible through the activeLoader property on the manager.
Depending on configuration the XRManager component will automatically manage the active loader at correct points in the scene lifecycle. The user can override certain points in the active loader lifecycle and manually manage them by toggling the Automatic Loading and Automatic Running properties through the inspector UI. Disabling Automatic Loading implies the the user is responsibile for the full lifecycle of the manager. Toggling this to false also toggles automatic running to false.
Disabling Automatic Running implies that the user is responsible for starting and stopping the activeLoader through the StartSubsystems() and StopSubsystems() APIs.
Automatic lifecycle management is executed as follows
- OnEnable -> InitializeLoader(). The loader list will be iterated over and the first successful loader will be set as the active loader.
- Start -> StartSubsystems(). Ask the active loader to start all subsystems.
- OnDisable -> StopSubsystems(). Ask the active loader to stop all subsystems.
- OnDestroy -> DeinitializeLoader(). Deinitialize and remove the active loader.
Inheritance
Namespace: UnityEngine.XR.Management
Syntax
public sealed class XRManagerSettings : ScriptableObject
Properties
activeLoader
Return the current singleton active loader instance.
Declaration
public XRLoader activeLoader { get; }
Property Value
Type | Description |
---|---|
XRLoader |
automaticLoading
Get and set Automatic Loading state for this manager. When this is true, the manager will automatically call
InitializeLoader() and
Declaration
public bool automaticLoading { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
automaticRunning
Get and set automatic running state for this manager. When set to true the manager will call StartSubsystems() and StopSubsystems() APIs at appropriate times. When set to false, or when automaticLoading is false then it is up to the user of the manager to handle that same functionality.
Declaration
public bool automaticRunning { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
isInitializationComplete
Read only boolean letting us know if initialization is completed. Because initialization is handled as a Coroutine, people taking advantage of the auto-lifecycle management of XRManager will need to wait for init to complete before checking for an ActiveLoader and calling StartSubsystems.
Declaration
public bool isInitializationComplete { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
loaders
List of loaders currently managed by this XR Manager instance.
Declaration
public List<XRLoader> loaders { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<XRLoader> |
Methods
ActiveLoaderAs<T>()
Declaration
public T ActiveLoaderAs<T>()
where T : XRLoader
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
DeinitializeLoader()
Declaration
public void DeinitializeLoader()
InitializeLoader()
Declaration
public IEnumerator InitializeLoader()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
InitializeLoaderSync()
Declaration
public void InitializeLoaderSync()
StartSubsystems()
Declaration
public void StartSubsystems()
StopSubsystems()
Declaration
public void StopSubsystems()