Class CompositionLayerUtils
Collection of utility methods that are useful for CompositionLayer.
Inherited Members
Namespace: Unity.XR.CompositionLayers.Services
Assembly: solution.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 typeFullName matches a LayerDataDescriptor an
instance of the LayerData type stored in the LayerDataDescriptor is returned.
If no matching LayerDataDescriptor is found null is returned.
|
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 |
Returns
Type | Description |
---|---|
LayerData | If the type matches a LayerDataDescriptor an
instance of the LayerData type stored in the LayerDataDescriptor is returned.
If no matching LayerDataDescriptor is found null is returned.
|
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)
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
typeFullName provided. If the is empty or the
LayerDataDescriptor is not found Empty is returned.
|
GetLayerDescriptor(Type)
Declaration
public static LayerDataDescriptor GetLayerDescriptor(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The of the corresponding LayerDataDescriptor.
|
Returns
Type | Description |
---|---|
LayerDataDescriptor | The LayerDataDescriptor that corresponds to the type
provided. If the is not a subclass of LayerData or the
LayerDataDescriptor is not found Empty is returned.
|
TryChangeLayerOrder(CompositionLayer, int, int, bool)
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, bool inEditor = false)
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. |
bool | inEditor |
Returns
Type | Description |
---|---|
bool | Returns if the layer is set to the newOrder or is already set to
newOrder .
|
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 |
if the method was able to swap the lhl and rhl
|