Class RectMask2D
Inherited Members
Component.GetComponentIndex()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Scene)
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Namespace: UnityEngine.UI
Assembly: UnityEngine.UI.dll
Syntax
[AddComponentMenu("UI/Rect Mask 2D", 14)]
[ExecuteAlways]
[DisallowMultipleComponent]
[RequireComponent(typeof(RectTransform))]
public class RectMask2D : UIBehaviour, IClipper, ICanvasRaycastFilter
Constructors
RectMask2D()
Declaration
protected RectMask2D()
Properties
canvasRect
Get the Rect for the mask in canvas space.
Declaration
public Rect canvasRect { get; }
Property Value
Type | Description |
---|---|
Rect |
padding
Padding to be applied to the masking X = Left Y = Bottom Z = Right W = Top
Declaration
public Vector4 padding { get; set; }
Property Value
Type | Description |
---|---|
Vector4 |
rectTransform
Helper function to get the RectTransform for the mask.
Declaration
public RectTransform rectTransform { get; }
Property Value
Type | Description |
---|---|
RectTransform |
softness
The softness to apply to the horizontal and vertical axis.
Declaration
public Vector2Int softness { get; set; }
Property Value
Type | Description |
---|---|
Vector2Int |
Methods
AddClippable(IClippable)
Add a IClippable to be tracked by the mask.
Declaration
public void AddClippable(IClippable clippable)
Parameters
Type | Name | Description |
---|---|---|
IClippable | clippable | Add the clippable object for this mask |
IsRaycastLocationValid(Vector2, Camera)
Declaration
public virtual bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | sp | |
Camera | eventCamera |
Returns
Type | Description |
---|---|
bool |
OnCanvasHierarchyChanged()
Called when the state of the parent Canvas is changed.
Declaration
protected override void OnCanvasHierarchyChanged()
Overrides
OnDestroy()
Declaration
protected override void OnDestroy()
Overrides
OnDisable()
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Declaration
protected override void OnEnable()
Overrides
OnTransformParentChanged()
Declaration
protected override void OnTransformParentChanged()
Overrides
OnValidate()
Declaration
protected override void OnValidate()
Overrides
PerformClipping()
Function to to cull / clip children elements.
Declaration
public virtual void PerformClipping()
Remarks
Called after layout and before Graphic update of the Canvas update loop.
RemoveClippable(IClippable)
Remove an IClippable from being tracked by the mask.
Declaration
public void RemoveClippable(IClippable clippable)
Parameters
Type | Name | Description |
---|---|---|
IClippable | clippable | Remove the clippable object from this mask |
UpdateClipSoftness()
Declaration
public virtual void UpdateClipSoftness()