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: Unity.XR.OpenXR.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 Register
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; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
CleanupState()
Declaration
public void CleanupState()
Dispose()
Used for cleanup and to call Dispose() on registered layer handlers.
Declaration
public void Dispose()
Remarks
This is called by the OpenXRLoader class when StopInternal() is invoked.
LateUpdate()
Declaration
public void LateUpdate()
RegisterLayerHandler(Type, ILayerHandler)
Registers a concrete Open
Declaration
public static void RegisterLayerHandler(Type layerDataType, OpenXRLayerProvider.ILayerHandler handler)
Parameters
Type | Name | Description |
---|---|---|
Type | layerDataType | The LayerData subclass to handle. |
Open |
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 Open
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<Composition |
layers | The list of all currently known CompositionLayer instances, regardless of active state. |
UpdateLayers(List<LayerInfo>, List<int>, List<LayerInfo>, List<LayerInfo>)
Called by the CompositionLayerManager to tell the instance of ILayerProvider about the current state of layers it is managing.
Declaration
public void UpdateLayers(List<CompositionLayerManager.LayerInfo> createdLayers, List<int> removedLayers, List<CompositionLayerManager.LayerInfo> modifiedLayers, List<CompositionLayerManager.LayerInfo> activeLayers)
Parameters
Type | Name | Description |
---|---|---|
List<Composition |
createdLayers | The list of layers that were just created. Any layer in
this list may be in the |
List<int> | removedLayers | The list of layers that are no longer being managed. Any layer in
this list should not be in the |
List<Composition |
modifiedLayers | The list of layers that have been recently modified. Any layer in
this list may also be in the |
List<Composition |
activeLayers | The list of layers currently active within the scene.
Layers in this list may also be in the |
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 |