Class MaskableGraphic
A Graphic that is capable of being masked out.
Inherited Members
Namespace: UnityEngine.UI
Assembly: UnityEngine.UI.dll
Syntax
public abstract class MaskableGraphic : Graphic, ICanvasElement, IClippable, IMaskable, IMaterialModifier
Fields
m_MaskMaterial
Declaration
[NonSerialized]
protected Material m_MaskMaterial
Field Value
Type | Description |
---|---|
Material |
m_ShouldRecalculateStencil
Declaration
[NonSerialized]
protected bool m_ShouldRecalculateStencil
Field Value
Type | Description |
---|---|
bool |
m_StencilValue
Declaration
[NonSerialized]
protected int m_StencilValue
Field Value
Type | Description |
---|---|
int |
Properties
isMaskingGraphic
Is this graphic the graphic on the same object as a Mask that is enabled.
Declaration
public bool isMaskingGraphic { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If toggled ensure to call MaskUtilities.NotifyStencilStateChanged(this); manually as it changes how stenciles are calculated for this image.
maskable
Does this graphic allow masking.
Declaration
public bool maskable { get; set; }
Property Value
Type | Description |
---|---|
bool |
onCullStateChanged
Callback issued when culling changes.
Declaration
public MaskableGraphic.CullStateChangedEvent onCullStateChanged { get; set; }
Property Value
Type | Description |
---|---|
MaskableGraphic.CullStateChangedEvent |
Remarks
Called whene the culling state of this MaskableGraphic either becomes culled or visible. You can use this to control other elements of your UI as culling happens.
Methods
Cull(Rect, bool)
See IClippable.Cull
Declaration
public virtual void Cull(Rect clipRect, bool validRect)
Parameters
Type | Name | Description |
---|---|---|
Rect | clipRect | |
bool | validRect |
GetModifiedMaterial(Material)
See IMaterialModifier.GetModifiedMaterial
Declaration
public virtual Material GetModifiedMaterial(Material baseMaterial)
Parameters
Type | Name | Description |
---|---|---|
Material | baseMaterial |
Returns
Type | Description |
---|---|
Material |
OnCanvasHierarchyChanged()
Called when the state of the parent Canvas is changed.
Declaration
protected override void OnCanvasHierarchyChanged()
Overrides
OnDisable()
Clear references.
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Mark the Graphic and the canvas as having been changed.
Declaration
protected override void OnEnable()
Overrides
OnTransformParentChanged()
Declaration
protected override void OnTransformParentChanged()
Overrides
OnValidate()
Declaration
protected override void OnValidate()
Overrides
RecalculateClipping()
See IClippable.RecalculateClipping
Declaration
public virtual void RecalculateClipping()
RecalculateMasking()
See IMaskable.RecalculateMasking
Declaration
public virtual void RecalculateMasking()
SetClipRect(Rect, bool)
See IClippable.SetClipRect
Declaration
public virtual void SetClipRect(Rect clipRect, bool validRect)
Parameters
Type | Name | Description |
---|---|---|
Rect | clipRect | |
bool | validRect |
SetClipSoftness(Vector2)
Set the clip softness for the IClippable.
The softness is a linear alpha falloff over clipSoftness pixels.
Declaration
public virtual void SetClipSoftness(Vector2 clipSoftness)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | clipSoftness | The number of pixels to apply the softness to |