Class OpenXRLayerProvider
Manages communication of changes between an application and the UnityOpenXR lib for all Unity.XR.CompositionLayers.Layers.LayerData objects.
Implements
Namespace: UnityEngine.XR.OpenXR.CompositionLayers
Assembly: solution.dll
Syntax
public class OpenXRLayerProvider : ILayerProvider, IDisposable
Remarks
OpenXR providers or extensions that create custom composition layer types or that override how the built-in
layer types are handled, must implement the ILayerProvider interface and register instances of
these implementations with the OpenXRLayerProvider via RegisterLayerHandler(Type, ILayerHandler).
Constructors
OpenXRLayerProvider()
Initializes and returns an instance of OpenXRLayerProvider.
Initializes and registers all the default, built-in layer handlers.
Declaration
public OpenXRLayerProvider()
Remarks
The OpenXRLayerProvider is created and disposed by the XRLoader.
You do not need to create an instance of OpenXRLayerProvider yourself. Layer handlers
should only use the static methods and properties of this class
Properties
isStarted
Reports whether the OpenXRLayerProvider has already been created and started.
Declaration
public static bool isStarted { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
CleanupState()
For internal use only.
Declaration
public void CleanupState()
Dispose()
Used to clean up.
Declaration
public void Dispose()
LateUpdate()
For internal use only.
Declaration
public void LateUpdate()
RegisterLayerHandler(Type, ILayerHandler)
Registers a concrete OpenXRLayerProvider.ILayerHandler object as the handler for all layers of a specific LayerData subclass.
Declaration
public static void RegisterLayerHandler(Type layerDataType, OpenXRLayerProvider.ILayerHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | layerDataType | The LayerData subclass to handle. |
| OpenXRLayerProvider.ILayerHandler | handler | The concrete |
Remarks
If more than one object registers itself as a handler for a specific LayerData type, the last registered handler is used.
The OpenXRLayerProvider invokes the registered layer handler's OpenXRLayerProvider.ILayerHandler methods
when any object of the associated LayerData type is updated in some way.
SetInitialState(List<LayerInfo>)
Sets the layer provider state on first assignment to the CompositionLayerManager.
Declaration
public void SetInitialState(List<CompositionLayerManager.LayerInfo> layers)
Parameters
| Type | Name | Description |
|---|---|---|
| List<CompositionLayerManager.LayerInfo> | layers |
UpdateLayers(List<LayerInfo>, List<int>, List<LayerInfo>, List<LayerInfo>)
Called by the CompositionLayerManager to update the current state of layers.
Declaration
public void UpdateLayers(List<CompositionLayerManager.LayerInfo> createdLayers, List<int> removedLayers, List<CompositionLayerManager.LayerInfo> modifiedLayers, List<CompositionLayerManager.LayerInfo> activeLayers)
Parameters
| Type | Name | Description |
|---|---|---|
| List<CompositionLayerManager.LayerInfo> | createdLayers | |
| List<int> | removedLayers | |
| List<CompositionLayerManager.LayerInfo> | modifiedLayers | |
| List<CompositionLayerManager.LayerInfo> | activeLayers |
Events
Started
Calls the methods in its invocation list when the OpenXRLayerProvider has started and registered it's built-in layer handlers.
Declaration
public static event Action Started
Event Type
| Type | Description |
|---|---|
| Action |
Remarks
You can use this event to wait for the OpenXRLayerProvider to finish registering its built-in layer handlers
so that you can override them with your own custom layer handlers.
Stopped
Calls the methods in its invocation list when the OpenXRLayerProvider has stopped and is disposed.
Declaration
public static event Action Stopped
Event Type
| Type | Description |
|---|---|
| Action |