Script documentation

Button.cs in TinyGiantStudio.Text namespace

If anything except method names starts with a capital letter, it's a property. Read the UI States section to understand what the terms like "press complete" mean in the asset.

Utility

Variable

Variable
Type
Description

Text

Background

Renderer

isSelected

bool

settings

Used to load default values when creating new button.

Methods

Method

SelectButton ()

This calls for all the required methods for selecting it. Visual, Module, Event, and if required, list events.

UnselectButton ()

This calls for all the required methods for unselecting it. Visual, Module, Event.

PressButton ()

This calls for all the required methods for selecting it. Visual, Module, Event, and if required, list events. Used everywhere except list.

PressButtonDontCallList ()

Same as PressButton except, it doesn't call list. Used by list to avoid recursion.

ButtonBeingPressed ()

PressCompleted ()

Uninteractable ()

Call this to set the button as Uninteractable

Interactable ()

Call this to set the button as Interactable

UnityEvents

Variable
Type
Description

unselectEvent

UnityEvent

This is the state that appears when a UI element enters the normal state from selected.

selectedEvent

UnityEvent

Mouse hover on the item or selected item via keyboard/controller in a list.

beingPressedEvent

UnityEvent

While the mouse/keyboard/controller button is pressed down or touch held down, the module or event is constantly called.

pressCompleteEvent

UnityEvent

When the user releases the key. In other words, the frame when the button/key or touch being pressed is complete.

Style

Variables

Variable
Type
Description

useStyles

bool

NormalTextSize

Vector3

NormalTextMaterial

Material

NormalBackgroundMaterial

Material

useSelectedVisual

bool

SelectedTextSize

Vector3

SelectedTextMaterial

Material

SelectedBackgroundMaterial

Material

usePressedVisual

bool

PressedTextSize

Vector3

PressedTextMaterial

Material

PressedBackgroundMaterial

Material

holdPressedVisualFor

float

UseDisabledVisual

bool

DisabledTextSize

Vector3

DisabledTextMaterial

DisabledBackgroundMaterial

Methods

Method

UpdateStyle ()

UnselectedButtonVisualUpdate ()

SelectedButtonVisualUpdate ()

PressButtonVisualUpdate ()

DisabledButtonVisualUpdate ()

Module

Variable
Type
Description

useModules

bool

If set to false, disables all modules from this button. Modules are called when entering a style for the first time.

unSelectedModuleContainers

applyUnSelectedModuleContainers

bool

selectedModuleContainers

applySelectedModuleContainers

bool

beingPressedModuleContainers

applyBeingPressedModuleContainers

bool

pressCompleteModuleContainers

applyPressCompleteModuleContainers

bool

Methods

Method
Description

UnselectButtonModuleUpdate ()

SelectedButtonModuleUpdate ()

BeingPressedButtonModuleUpdate ()

PressCompleteButtonModuleUpdate ()

Version History

v4.0.3 (June 2, 2023)

Renamed "unSelect" to "unSelected" for consistency with the rest of the asset.

  1. onUnselect to unselectEvent

  2. unSelectModuleContainers to unSelectedModuleContainers

  3. applyUnSelectModuleContainers to applyUnSelectedModuleContainers

Renamed "onSelect" to "selected" for code consistency with the rest of the asset.

  1. onSelect to selectedEvent

  2. onSelectModuleContainers to selectedModuleContainers

  3. applyOnSelectModuleContainers to applySelectModuleContainers

Renamed "onPress" to "beingPressed" for clarity about the fact that this is called constantly while the UI element is being pressed.

  1. whileBeingClicked to beingPressedEvent

  2. onPressModuleContainers to beingPressedModuleContainers

  3. applyOnPressModuleContainers to applyBeingPressedModuleContainers

  4. ButtonBeingPressedModuleUpdate to

Renamed "onClick" to "pressComplete" for clarity about what it does.

  1. onClick to pressCompleteEvent

  2. onClickModuleContainers to pressCompleteModuleContainers

  3. applyOnClickModuleContainers to applyPressCompleteModuleContainers

  4. Method PressedButtonClickStopped() to PressCompleted()

  5. Method OnClickButtonModuleUpdate() to PressCompleteButtonModuleUpdate ()

OnPressButtonModuleUpdate to ButtonBeingPressedModuleUpdate renamed to better clarify what it does.

Last updated