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 | The text assigned to the button. The button can change material, text size depending on Style. | |
Background | Renderer | The background is assigned to the button. The button can change material depending on Style. |
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.
onUnselect
tounselectEvent
unSelectModuleContainers
tounSelectedModuleContainers
applyUnSelectModuleContainers
toapplyUnSelectedModuleContainers
Renamed "onSelect" to "selected" for code consistency with the rest of the asset.
onSelect
toselectedEvent
onSelectModuleContainers
toselectedModuleContainers
applyOnSelectModuleContainers
toapplySelectModuleContainers
Renamed "onPress" to "beingPressed" for clarity about the fact that this is called constantly while the UI element is being pressed.
whileBeingClicked
tobeingPressedEvent
onPressModuleContainers
tobeingPressedModuleContainers
applyOnPressModuleContainers
toapplyBeingPressedModuleContainers
ButtonBeingPressedModuleUpdate to
Renamed "onClick" to "pressComplete" for clarity about what it does.
onClick
topressCompleteEvent
onClickModuleContainers
topressCompleteModuleContainers
applyOnClickModuleContainers
toapplyPressCompleteModuleContainers
Method
PressedButtonClickStopped()
toPressCompleted()
Method
OnClickButtonModuleUpdate()
toPressCompleteButtonModuleUpdate ()
OnPressButtonModuleUpdate
to ButtonBeingPressedModuleUpdate
renamed to better clarify what it does.
Last updated