Home › Page › UghControl


Inherits from UghSprite

This is an abstract class. This means that it cannot be instantiated on its own, only subclassed. Examples of UghControl subclasses are UghButton, UghToggle, and UghScrollView.

name type description
HotFingerID int The ID of the finger interacting with this control
isLegalControl boolean Is this a legal control?
Class Variables
name type description
theOnlyLegalControls UghControl[] Array of all currently legal controls
Inherited Variables
name type description
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?
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
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
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


Understanding the UghControl abstract class

UghControl is the abstract class that all interactive Ugh type assets derive from. It in turn derives from UghSprite.

The important things to note in UghControl, are the UghControl array: theOnlyLegalControls, which can be filled with UghControls so that they are the exclusive UghControls that will process input.

theOnlyLegalControls can only be interacted with in script, since it is a member of this abstract class, and is typically set to null so that all UghControls will process input.

The other thing to note is the IsLegalControl property, which returns true if the theOnlyLegalControls array is null or if the calling UghControl is in the legal controls array.

This property is used by UghInput to determine if the calling UghControl is valid and can fire the Input events such as OnUghInputDown and OnUghInputUpAsButton.