Class LayerExtensions
Extension methods for Unity's LayerMask struct
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit
Assembly: cs.temp.dll.dll
Syntax
public static class LayerExtensions
Fields
InvalidLayerId
The Invalid Layer Id.
Declaration
public const int InvalidLayerId = -1
Field Value
Type | Description |
---|---|
Int32 |
InvalidLayerId
The Invalid Layer Id.
Declaration
public const int InvalidLayerId = -1
Field Value
Type | Description |
---|---|
Int32 |
Methods
Combine(LayerMask[])
Combines provided layers into a single layer mask.
Declaration
public static int Combine(this LayerMask[] layerMaskList)
Parameters
Type | Name | Description |
---|---|---|
LayerMask[] | layerMaskList |
Returns
Type | Description |
---|---|
Int32 | The combined layer mask |
Combine(LayerMask[])
Combines provided layers into a single layer mask.
Declaration
public static int Combine(this LayerMask[] layerMaskList)
Parameters
Type | Name | Description |
---|---|---|
LayerMask[] | layerMaskList |
Returns
Type | Description |
---|---|
Int32 | The combined layer mask |
FindLayerListIndex(Int32, LayerMask[])
Look through the layerMaskList and find the index in that list for which the supplied layer is part of
Declaration
public static int FindLayerListIndex(this int layer, LayerMask[] layerMasks)
Parameters
Type | Name | Description |
---|---|---|
Int32 | layer | Layer to search for |
LayerMask[] | layerMasks | List of LayerMasks to search |
Returns
Type | Description |
---|---|
Int32 | LayerMaskList index, or -1 for not found |
FindLayerListIndex(Int32, LayerMask[])
Look through the layerMaskList and find the index in that list for which the supplied layer is part of
Declaration
public static int FindLayerListIndex(this int layer, LayerMask[] layerMasks)
Parameters
Type | Name | Description |
---|---|---|
Int32 | layer | Layer to search for |
LayerMask[] | layerMasks | List of LayerMasks to search |
Returns
Type | Description |
---|---|
Int32 | LayerMaskList index, or -1 for not found |
GetLayerId(ref Int32, String)
Gets a valid layer id using the layer name.
Declaration
public static int GetLayerId(ref int cache, string layerName)
Parameters
Type | Name | Description |
---|---|---|
Int32 | cache | The cached layer id. |
String | layerName | The name of the layer to look for if the cache is unset. |
Returns
Type | Description |
---|---|
Int32 | The layer id. |
GetLayerId(ref Int32, String)
Gets a valid layer id using the layer name.
Declaration
public static int GetLayerId(ref int cache, string layerName)
Parameters
Type | Name | Description |
---|---|---|
Int32 | cache | The cached layer id. |
String | layerName | The name of the layer to look for if the cache is unset. |
Returns
Type | Description |
---|---|
Int32 | The layer id. |
IsInLayerMask(Int32, Int32)
Checks whether a layer is in a layer mask
Declaration
public static bool IsInLayerMask(this int layer, int layerMask)
Parameters
Type | Name | Description |
---|---|---|
Int32 | layer | |
Int32 | layerMask |
Returns
Type | Description |
---|---|
Boolean | True if the layer mask contains the layer |
IsInLayerMask(Int32, Int32)
Checks whether a layer is in a layer mask
Declaration
public static bool IsInLayerMask(this int layer, int layerMask)
Parameters
Type | Name | Description |
---|---|---|
Int32 | layer | |
Int32 | layerMask |
Returns
Type | Description |
---|---|
Boolean | True if the layer mask contains the layer |
ToMask(Int32)
Transform layer id to LayerMask
Declaration
public static LayerMask ToMask(int layerId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | layerId |
Returns
Type | Description |
---|---|
LayerMask |
ToMask(Int32)
Transform layer id to LayerMask
Declaration
public static LayerMask ToMask(int layerId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | layerId |
Returns
Type | Description |
---|---|
LayerMask |