Class CompositionLayerUtils
Collection of utility methods that are useful for CompositionLayer.
Inherited Members
Namespace: Unity.XR.CompositionLayers.Services
Assembly: Unity.XR.CompositionLayers.dll
Syntax
public static class CompositionLayerUtils
Methods
AddSuggestedExtensions(CompositionLayer)
Adds the components listed in the SuggestedExtensions from the
LayerDataDescriptor corresponding to the layer's GameObject.
Declaration
public static void AddSuggestedExtensions(this CompositionLayer layer)
Parameters
| Type | Name | Description |
|---|---|---|
| CompositionLayer | layer | The CompositionLayer add the SuggestedExtensions components to. |
CanChangeOrderTo(CompositionLayer, int)
Checks if the CompositionLayer layer be changed to the order value.
Declaration
public static bool CanChangeOrderTo(this CompositionLayer layer, int order)
Parameters
| Type | Name | Description |
|---|---|---|
| CompositionLayer | layer | The CompositionLayer to check if can be set to the |
| int | order | The value to check if the |
Returns
| Type | Description |
|---|---|
| bool |
|
CreateLayerData(string)
Uses typeFullName to find the LayerData type in the corresponding
LayerDataDescriptor. Then creates and returns an instance of the LayerData.
Declaration
public static LayerData CreateLayerData(string typeFullName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | typeFullName | The type's full name that corresponds to a LayerDataDescriptor that holds the LayerData type information. |
Returns
| Type | Description |
|---|---|
| LayerData | If the |
CreateLayerData(Type)
Uses type to find the LayerData type in the corresponding LayerDataDescriptor. Then creates and returns an instance of the LayerData.
Declaration
public static LayerData CreateLayerData(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type of the Layer Data |
Returns
| Type | Description |
|---|---|
| LayerData | If the |
GetAllLayerDescriptors()
Gets a new copy of a list including all known LayerDataDescriptor.
Declaration
public static List<LayerDataDescriptor> GetAllLayerDescriptors()
Returns
| Type | Description |
|---|---|
| List<LayerDataDescriptor> | A list of all known LayerDataDescriptor. |
GetLayerDescriptor(string)
Gets the LayerDataDescriptor that matches typeFullName.
Declaration
public static LayerDataDescriptor GetLayerDescriptor(string typeFullName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | typeFullName | Id of the corresponding LayerDataDescriptor. |
Returns
| Type | Description |
|---|---|
| LayerDataDescriptor | The LayerDataDescriptor that corresponds to the |
GetLayerDescriptor(Type)
Gets the LayerDataDescriptor that matches the Type type.
Declaration
public static LayerDataDescriptor GetLayerDescriptor(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The |
Returns
| Type | Description |
|---|---|
| LayerDataDescriptor | The LayerDataDescriptor that corresponds to the |
TryChangeLayerOrder(CompositionLayer, int, int)
Try to change the layer's order and update the order registered with the
CompositionLayerManager from oldOrder to a new order value newOrder.
Declaration
public static bool TryChangeLayerOrder(this CompositionLayer layer, int oldOrder, int newOrder)
Parameters
| Type | Name | Description |
|---|---|---|
| CompositionLayer | layer | The CompositionLayer to change the order value of. |
| int | oldOrder | The old CompositionLayer order value this is usually the current Order. |
| int | newOrder | The new CompositionLayer order value to set. |
Returns
| Type | Description |
|---|---|
| bool | Returns |
TrySwapLayers(CompositionLayer, CompositionLayer)
Tries to swap the Order values of lhl and rhl.
Declaration
public static bool TrySwapLayers(this CompositionLayer lhl, CompositionLayer rhl)
Parameters
| Type | Name | Description |
|---|---|---|
| CompositionLayer | lhl | Left hand CompositionLayer to swap the order of. |
| CompositionLayer | rhl | Right hand CompositionLayer to swap the order of. |
Returns
| Type | Description |
|---|---|
| bool |
|