Class MaskUtilities
Mask related utility class. This class provides masking-specific utility functions.
Inherited Members
Namespace: UnityEngine.UI
Assembly: UnityEngine.UI.dll
Syntax
public class MaskUtilities
Methods
FindRootSortOverrideCanvas(Transform)
Find a root Canvas.
Declaration
public static Transform FindRootSortOverrideCanvas(Transform start)
Parameters
Type | Name | Description |
---|---|---|
Transform | start | Transform to start the search at going up the hierarchy. |
Returns
Type | Description |
---|---|
Transform | Finds either the most root canvas, or the first canvas that overrides sorting. |
GetRectMaskForClippable(IClippable)
Find the correct RectMask2D for a given IClippable.
Declaration
public static RectMask2D GetRectMaskForClippable(IClippable clippable)
Parameters
Type | Name | Description |
---|---|---|
IClippable | clippable | Clippable to search from. |
Returns
Type | Description |
---|---|
RectMask2D | The Correct RectMask2D |
GetRectMasksForClip(RectMask2D, List<RectMask2D>)
Search for all RectMask2D that apply to the given RectMask2D (includes self).
Declaration
public static void GetRectMasksForClip(RectMask2D clipper, List<RectMask2D> masks)
Parameters
Type | Name | Description |
---|---|---|
RectMask2D | clipper | Starting clipping object. |
List<RectMask2D> | masks | The list of Rect masks |
GetStencilDepth(Transform, Transform)
Find the stencil depth for a given element.
Declaration
public static int GetStencilDepth(Transform transform, Transform stopAfter)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | The starting transform to search. |
Transform | stopAfter | Where the search of parents should stop |
Returns
Type | Description |
---|---|
int | What the proper stencil buffer index should be. |
IsDescendantOrSelf(Transform, Transform)
Helper function to determine if the child is a descendant of father or is father.
Declaration
public static bool IsDescendantOrSelf(Transform father, Transform child)
Parameters
Type | Name | Description |
---|---|---|
Transform | father | The transform to compare against. |
Transform | child | The starting transform to search up the hierarchy. |
Returns
Type | Description |
---|---|
bool | Is child equal to father or is a descendant. |
Notify2DMaskStateChanged(Component)
Notify all IClippables under the given component that they need to recalculate clipping.
Declaration
public static void Notify2DMaskStateChanged(Component mask)
Parameters
Type | Name | Description |
---|---|---|
Component | mask | The object thats changed for whose children should be notified. |
NotifyStencilStateChanged(Component)
Notify all IMaskable under the given component that they need to recalculate masking.
Declaration
public static void NotifyStencilStateChanged(Component mask)
Parameters
Type | Name | Description |
---|---|---|
Component | mask | The object thats changed for whose children should be notified. |