Home › Page › UghButtonDisablable


Ugh Scripting Reference > UghControl > UghButton > UghButtonDisablable

Inherits fron UghButton

UghButtonDiablable is an UghButton that can be disabled. When disabled, it shows an “unlocked” sprite and does not respond to user input at all. See UghButton for general UghButton use.

name type description
unlocked UghSpriteDefinition The UghSpriteDefinition for when this button is unlocked, or enabled. It is, by default, locked and disabled.
name type description
SetLock void Sets the locked state to the given boolean.
ToggleLock void Toggles the locked state of the button.
Inherited Variables
name type description
autoSizeCollider boolean Do we automatically resize the collider for this button?
mouseOver UghSpriteDefinition The sprite definition for when the mouse hovers over the button
pressed UghSpriteDefinition The sprite definition for when the mouse is clicking on or a finger is tapping on the button
anchor UghSprite.Anchor The corner or custom point that the UghControl is anchored to
customAnchorOffset Vector3 The offset values for a custom anchor
flippedHorizontal boolean Is the UghSprite flipped horizonally?
flippedVertical boolean Is the UghSprite flipped vertically?
HotFingerID int The ID of the finger interacting with this control
isLegalControl boolean Is this a legal control?
normal UghSpriteDefinition The default UghSpriteDefinition for this button
Prototype UghSpritePrototype The current UghSpritePrototype for this button
Offset Vector3 The offset of the UghSprite
Inherited Functions
name type description
OnDown event An event fired when the button is pressed down
OnUghInputDown void Runs when the mouse clicks or a finger taps on this button
OnUghInputUp void Runs when the mouse or finger drags off this button
OnUghInputUpAsButton void Runs when the mouse stops clicking or a finger lifts up when over this button
OnPressed event An event fired when the button is released with the input over the button, at the same time as OnUghInputAsButton
GetLocalCenter Vector3 Returns the local center of the UghControl
GetLocalOrigin Vector3 Returns the local origin of the UghControl
GetParentPublisher UghPublisher Returns the UghPublisher which this UghControl belongs to, or null if none
UpdateMesh void Updates this control's mesh
Inherited Class Variables
name type description
Anchor enum Enum for different common anchor positions
AnchorToTextAnchor TextAnchor Converts an Anchor enum into a TextAnchor enum
TextAnchorToAnchor UghSprite.Anchor Converts a TextAnchor enum into an Anchor enum
theOnlyLegalControls UghControl[] Array of all currently legal controls
Inherited Class Functions
name type description
ForceUpdateAllUghSpriteMeshes void Forces every UghSprite's mesh to update
GetOffsetForAnchor Vector3 Returns the Vector3 offset for a given Anchor value


Using UghButtonDisablable in script

UghButtonDisablable is a subclass of UghButton which adds the ability to use the button as an unlockable button.

The unlocked variable is where the UghSpriteDefinition of the locked version of your button is held.

Added Functions

public void SetLock(bool b)

This function is the public access for setting the locked state of the UghButtonDisableable.

public void ToggleLock()

This function just flips the locked state to the opposite state.

If you do not use an UghPublisher to manage your UghButtonDisablable, as with many other UghControls, you must register for the OnDown and/or the OnPressed events to know when the UghButtonDisablable has been interacted with.