Class Util
Miscellaneous utility code.
Namespace: MouseDance.Runtime
Assembly: MouseDance.Runtime.dll
Syntax
public static class Util
Methods
FindBitPosition(Int32)
Given an int that represents a bitmask, find the position of the first bit that is set to 1.
Declaration
public static int FindBitPosition(this int n)
Parameters
Type | Name | Description |
---|---|---|
Int32 | n | int value that we're checking. |
Returns
Type | Description |
---|---|
Int32 | A value from 0 to 31. |
Remarks
If specified int is not power-of-two, we'll end up returning the position of the first bit that is set, ignoring the rest.
SetLayerDeep(Component, Int32)
Change layer of GameObject, plus all of its children. Uses stack instead of recursive calls.
Declaration
public static void SetLayerDeep(this Component c, int layer)
Parameters
Type | Name | Description |
---|---|---|
Component | c | The component whose GameObject we'll be editing. |
Int32 | layer | The 0 to 31 value of the layer. |
SetLayerDeep(Component, LayerMask)
Change layer of GameObject, plus all of its children. Uses stack instead of recursive calls.
Declaration
public static void SetLayerDeep(this Component c, LayerMask layer)
Parameters
Type | Name | Description |
---|---|---|
Component | c | The component whose GameObject we'll be editing. |
LayerMask | layer | Uses first layer toggled in this LayerMask. |
SetLayerDeep(Component, LayerMask, Stack<Transform>)
Change layer of GameObject, plus all of its children. Uses stack instead of recursive calls.
Declaration
public static void SetLayerDeep(this Component c, LayerMask layer, Stack<Transform> stack)
Parameters
Type | Name | Description |
---|---|---|
Component | c | The component whose GameObject we'll be editing. |
LayerMask | layer | Uses first layer toggled in this LayerMask. |
Stack<Transform> | stack | The stack to use as the buffer for traversing all children of the GameObject. |
SetLayerDeep(Transform, Int32, Stack<Transform>)
Change layer of GameObject, plus all of its children. Uses stack instead of recursive calls.
Declaration
public static void SetLayerDeep(this Transform t, int layer, Stack<Transform> stack)
Parameters
Type | Name | Description |
---|---|---|
Transform | t | The Transform whose GameObject we'll be editing. |
Int32 | layer | The 0 to 31 value of the layer. |
Stack<Transform> | stack | The stack to use as the buffer for traversing all children of the GameObject. |