Class CompositionLayer
Base class for all composition layer types. Derive from this and extend to add your own layer type.
Inherited Members
Namespace: Unity.XR.CompositionLayers
Assembly: Unity.XR.CompositionLayers.dll
Syntax
[ExecuteAlways]
[DisallowMultipleComponent]
[AddComponentMenu("XR/Composition Layers/Composition Layer")]
[Icon("Packages/com.unity.xr.compositionlayers/Editor/Icons/d_LayerUniversal.png")]
[DefaultExecutionOrder(-2147483648)]
public sealed class CompositionLayer : MonoBehaviourProperties
Extensions
Provides access to the list of CompositionLayerExtension components that are currently enabled on this CompositionLayer gameObject.
Declaration
public List<CompositionLayerExtension> Extensions { get; }Property Value
| Type | Description | 
|---|---|
| List<CompositionLayerExtension> | 
LayerData
The data associated with the layer type this layer is set to.
Declaration
public LayerData LayerData { get; }Property Value
| Type | Description | 
|---|---|
| LayerData | ScriptableObject instance for layer data. | 
Order
The layer ordering of this layer in relation to the main eye layer. Order less than 0 will render under the eye layer in ascending order. Order greater than or equal to 0 will render over the eye layer in ascending order.
Declaration
public int Order { get; set; }Property Value
| Type | Description | 
|---|---|
| int | 
OrderInitialized
Order Initialized is used to track if the Order is initialized to a valid value. A Order has been initialized when the CompositionLayer is managed with the CompositionLayerManager.
Declaration
public bool OrderInitialized { get; }Property Value
| Type | Description | 
|---|---|
| bool | 
Methods
ChangeLayerDataType(string)
Will populate the layer data with existing data associated with that typeFullName.
Declaration
public void ChangeLayerDataType(string typeFullName)Parameters
| Type | Name | Description | 
|---|---|---|
| string | typeFullName | The layer Id for the LayerData type. | 
ChangeLayerDataType(Type)
Sets the LayerData and base on a LayerDataDescriptor subclass defined by the passed in Type.
Declaration
public void ChangeLayerDataType(Type type)Parameters
| Type | Name | Description | 
|---|---|---|
| Type | type | The type of LayerData to change the layer type to. | 
ChangeLayerDataType(LayerData)
Sets the LayerData.
Declaration
public void ChangeLayerDataType(LayerData layer)Parameters
| Type | Name | Description | 
|---|---|---|
| LayerData | layer | The LayerData instance to assign. | 
ChangeLayerDataType(LayerDataDescriptor)
Sets the layer type from the LayerDataDescriptor. LayerData is populated from data associated with the LayerDataDescriptor.
Declaration
public void ChangeLayerDataType(LayerDataDescriptor descriptor)Parameters
| Type | Name | Description | 
|---|---|---|
| LayerDataDescriptor | descriptor | The LayerDataDescriptor for a type of LayerData | 
ChangeLayerDataType<T>()
Sets the LayerData base on a LayerDataDescriptor subclass of type T.
Declaration
public void ChangeLayerDataType<T>() where T : LayerDataType Parameters
| Name | Description | 
|---|---|
| T | The type of LayerData to change the layer type to. | 
GetPlatformLayerData<T>()
Get/Desrialize PlatformLayerData. This function keeps deselized PlatformLayerData internally.
Declaration
public T GetPlatformLayerData<T>() where T : PlatformLayerDataReturns
| Type | Description | 
|---|---|
| T | PlatformLayerData. | 
Type Parameters
| Name | Description | 
|---|---|
| T | The type of PlatformLayerData changed to. | 
SetPlatformLayerData(PlatformLayerData)
Set/Serialize PlatformLayerData.
Declaration
public void SetPlatformLayerData(PlatformLayerData platformLayerData)Parameters
| Type | Name | Description | 
|---|---|---|
| PlatformLayerData | platformLayerData | Target PlatformLayerData. |