> For the complete documentation index, see [llms.txt](https://ferdowsur.gitbook.io/modular-3d-text/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ferdowsur.gitbook.io/modular-3d-text/ui/button/script-documentation.md).

# 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*](/modular-3d-text/utility/ui-states.md) *to understand what the terms like "press complete" mean in the asset.*

## *<mark style="color:yellow;">Utility</mark>*

### *<mark style="color:orange;">Variable</mark>*

<table data-full-width="true"><thead><tr><th width="226">Variable</th><th width="203">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Text</strong></td><td><a href="/modular-3d-text/text/modular-3d-text.md">Modular3DText</a></td><td><em>The text assigned to the button. The button can change material, text size depending on</em> <a href="/modular-3d-text/ui/button.md#style"><em>Style</em></a><em>.</em></td></tr><tr><td><strong>Background</strong></td><td>Renderer</td><td><em>The background is assigned to the button. The button can change material depending on</em> <a href="/modular-3d-text/ui/button.md#style"><em>Style</em></a><em>.</em></td></tr><tr><td><strong>isSelected</strong></td><td>bool</td><td></td></tr><tr><td><strong>settings</strong></td><td><a href="/modular-3d-text/utility/asset-settings.md">AssetSettings</a></td><td><em>Used to load default values when creating new button.</em></td></tr></tbody></table>

### *<mark style="color:orange;">Methods</mark>*

<table data-full-width="true"><thead><tr><th width="296">Method</th><th></th></tr></thead><tbody><tr><td><strong>SelectButton</strong> ()</td><td><em>This calls for all the required methods for selecting it.</em><br><em>Visual, Module, Event, and if required, list events.</em></td></tr><tr><td><strong>UnselectButton</strong> ()</td><td><em>This calls for all the required methods for unselecting it.</em><br><em>Visual, Module, Event.</em></td></tr><tr><td><strong>PressButton</strong> ()</td><td><em>This calls for all the required methods for selecting it.</em><br><em>Visual, Module, Event, and if required, list events.</em><br><em>Used everywhere except list.</em></td></tr><tr><td><strong>PressButtonDontCallList</strong> ()</td><td><em>Same as <strong>PressButton</strong> except, it doesn't call list.</em><br><em>Used by list to avoid recursion.</em></td></tr><tr><td><strong>ButtonBeingPressed</strong> ()</td><td></td></tr><tr><td><strong>PressCompleted</strong> ()</td><td></td></tr><tr><td><strong>Uninteractable</strong> ()</td><td><em>Call this to set the button as Uninteractable</em></td></tr><tr><td><strong>Interactable</strong> ()</td><td>Call this to set the button as Interactable</td></tr></tbody></table>

## *<mark style="color:yellow;">UnityEvents</mark>*

<table data-full-width="true"><thead><tr><th width="221">Variable</th><th width="175">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>unselectEvent</strong></td><td>UnityEvent</td><td><em>This is the state that appears when a UI element enters the normal state from selected.</em></td></tr><tr><td><strong>selectedEvent</strong></td><td>UnityEvent</td><td><em>Mouse hover on the item or selected item via keyboard/controller in a list.</em></td></tr><tr><td><strong>beingPressedEvent</strong></td><td>UnityEvent</td><td><em>While the mouse/keyboard/controller button is pressed down or touch held down, the module or event is constantly called.</em></td></tr><tr><td><strong>pressCompleteEvent</strong></td><td>UnityEvent</td><td><em>When the user releases the key. In other words, the frame when the button/key or touch being pressed is complete.</em></td></tr></tbody></table>

## *<mark style="color:yellow;">Style</mark>*

### *<mark style="color:orange;">Variables</mark>*

<table data-full-width="true"><thead><tr><th width="280">Variable</th><th width="110">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>useStyles</strong></td><td>bool</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>NormalTextSize</strong></td><td>Vector3</td><td></td></tr><tr><td><strong>NormalTextMaterial</strong></td><td>Material</td><td></td></tr><tr><td><strong>NormalBackgroundMaterial</strong></td><td>Material</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>useSelectedVisual</strong></td><td>bool</td><td></td></tr><tr><td><strong>SelectedTextSize</strong></td><td>Vector3</td><td></td></tr><tr><td><strong>SelectedTextMaterial</strong></td><td>Material</td><td></td></tr><tr><td><strong>SelectedBackgroundMaterial</strong></td><td>Material</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>usePressedVisual</strong></td><td>bool</td><td></td></tr><tr><td><strong>PressedTextSize</strong></td><td>Vector3</td><td></td></tr><tr><td><strong>PressedTextMaterial</strong></td><td>Material</td><td></td></tr><tr><td><strong>PressedBackgroundMaterial</strong></td><td>Material</td><td></td></tr><tr><td><strong>holdPressedVisualFor</strong></td><td>float</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>UseDisabledVisual</strong></td><td>bool</td><td></td></tr><tr><td><strong>DisabledTextSize</strong></td><td>Vector3</td><td></td></tr><tr><td><strong>DisabledTextMaterial</strong></td><td></td><td></td></tr><tr><td><strong>DisabledBackgroundMaterial</strong></td><td></td><td></td></tr></tbody></table>

### *<mark style="color:orange;">Methods</mark>*

<table data-full-width="true"><thead><tr><th>Method</th><th></th></tr></thead><tbody><tr><td><strong>UpdateStyle</strong> ()</td><td></td></tr><tr><td><strong>UnselectedButtonVisualUpdate</strong> ()</td><td></td></tr><tr><td><strong>SelectedButtonVisualUpdate</strong> ()</td><td></td></tr><tr><td><strong>PressButtonVisualUpdate</strong> ()</td><td></td></tr><tr><td><strong>DisabledButtonVisualUpdate</strong> ()</td><td></td></tr></tbody></table>

## *<mark style="color:yellow;">Module</mark>*

<table data-full-width="true"><thead><tr><th width="376">Variable</th><th width="163">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>useModules</strong></td><td>bool</td><td>If set to false, disables all modules from this button. Modules are called when entering a style for the first time.</td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>unSelectedModuleContainers</strong></td><td><a href="https://ferdowsur.gitbook.io/modules/module-container">ModuleContainer</a> </td><td></td></tr><tr><td><strong>applyUnSelectedModuleContainers</strong></td><td>bool</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>selectedModuleContainers</strong></td><td><a href="https://ferdowsur.gitbook.io/modules/module-container">ModuleContainer</a> </td><td></td></tr><tr><td><strong>applySelectedModuleContainers</strong></td><td>bool</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>beingPressedModuleContainers</strong></td><td><a href="https://ferdowsur.gitbook.io/modules/module-container">ModuleContainer</a> </td><td></td></tr><tr><td><strong>applyBeingPressedModuleContainers</strong></td><td>bool</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>pressCompleteModuleContainers</strong></td><td><a href="https://ferdowsur.gitbook.io/modules/module-container">ModuleContainer</a> </td><td></td></tr><tr><td><strong>applyPressCompleteModuleContainers</strong></td><td>bool</td><td></td></tr></tbody></table>

### *<mark style="color:orange;">Methods</mark>*

<table data-full-width="true"><thead><tr><th>Method</th><th>Description</th></tr></thead><tbody><tr><td><strong>UnselectButtonModuleUpdate</strong> ()</td><td></td></tr><tr><td><strong>SelectedButtonModuleUpdate</strong> ()</td><td></td></tr><tr><td><strong>BeingPressedButtonModuleUpdate</strong> ()</td><td></td></tr><tr><td><strong>PressCompleteButtonModuleUpdate</strong> ()</td><td></td></tr><tr><td></td><td></td></tr><tr><td><strong>EmptyEffect</strong> (<em>List</em> &#x3C;<a href="https://ferdowsur.gitbook.io/modules/module-container"><em>ModuleContainer</em></a>> <strong>moduleList</strong>, <em>Module</em> <strong>module</strong> = null)</td><td></td></tr></tbody></table>

## <mark style="color:yellow;">Version History</mark>

### *<mark style="color:orange;">v4.0.3</mark> (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&#x20;

*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.
