# Script documentation

*If anything except method names starts with a capital letter, it's a property.*\
*Read the* [*UI States section*](https://ferdowsur.gitbook.io/modular-3d-text/utility/ui-states) *to understand what the terms like "press complete" mean in the asset.*

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

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

<table data-full-width="true"><thead><tr><th width="284.3333333333333">Variable</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>selectedItem</strong></td><td>int</td><td></td></tr><tr><td><strong>autoFocusOnStart</strong></td><td>bool</td><td><em>If set to true, the list is focused on awake. The list is scrollable with a keyboard when focused.</em></td></tr><tr><td><strong>autoFocusFirstItem</strong></td><td>bool</td><td><em>Selects first item in the list when focused.</em></td></tr></tbody></table>

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

<table data-full-width="true"><thead><tr><th width="290.3333333333333">Method</th><th>Description</th></tr></thead><tbody><tr><td><strong>UpdateList</strong> ()</td><td><em>Updates the positioning of items in the list if it has a layout group.</em></td></tr><tr><td></td><td></td></tr><tr><td><strong>Focus</strong> ()</td><td><em>Toggles the focus on the list.</em> <br><em>When a list is focused, it can be scrolled with a keyboard/controller, if that is enabled.</em></td></tr><tr><td><strong>Focus</strong> (<em>bool</em> <strong>enable</strong>)</td><td><em>Enables/disables focus depending on the bool passed as a parameter.</em> <br><em>When a list is focused, it can be scrolled with a keyboard/controller, if that is enabled.</em></td></tr><tr><td><strong>Focus</strong> (<em>bool</em> <strong>enable</strong><em>, bool</em> <strong>delay</strong>)</td><td><em>If the second parameter delay is set to true, the list is focused after a single frame.</em><br><em>Enables/disables focus depending on the bool passed as the first parameter.</em> <br><em>When a list is focused, it can be scrolled with a keyboard/controller, if that is enabled.</em></td></tr><tr><td></td><td></td></tr><tr><td><strong>SelectItem</strong> (<em>int</em> <strong>number</strong>)</td><td><em>Processes the selected item for the list.</em> <br><em>Doesn't let the selected item know it was selected.</em><br><em>Call the <strong>AlertSelectedItem</strong>(int <strong>number</strong>) to update the UI item.</em></td></tr><tr><td><strong>AlertSelectedItem</strong> (<em>int</em> <strong>number</strong>)</td><td><em>Alerts the list item that was selected.</em> <br><em>Doesn't alert the list.</em><br><em>Call the</em> <strong>SelectItem</strong> (<em>int</em> <strong>number</strong>) <em>to update the UI item.</em></td></tr><tr><td></td><td></td></tr><tr><td><strong>UnselectItem</strong>(<em>int</em> <strong>number</strong>)</td><td><em>Unselects the child in the list whose index was passed as parameter.</em></td></tr><tr><td><strong>UnselectEverything</strong> ()</td><td>Unselects everything.</td></tr><tr><td><strong>UnselectEverythingExceptSelected</strong> ()</td><td>Unselects everything except the selected item. This is useful for handling UI with random states being added to the list.</td></tr><tr><td><strong>UnselectEverythingDontChangeSelectedItemValue</strong> ()</td><td>Unselects everything but does not reset the "selectedItem" number.<br>Keeping the selected item value means the previously selected item can still be pressed after selected and scrolling via keyboard continues from the previously selected one instead of starting from 0</td></tr><tr><td></td><td></td></tr><tr><td><strong>PressSelectedItem</strong> ()</td><td></td></tr><tr><td><strong>PresstItem</strong> (<em>int</em> <strong>number</strong>)</td><td></td></tr></tbody></table>

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

*Styles control child element visuals.*

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

<table data-full-width="true"><thead><tr><th>Variable</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>UseStyle</strong></td><td>bool</td><td><em>If set to false, disables all style controls from this list.</em></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>UseNormalItemVisual</strong></td><td>bool</td><td><em>If set to false, disables normal style from being applied from this list. An individual element's own style is used in that case.</em></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>UseSelectedItemVisual</strong></td><td>bool</td><td><em>If set to false, disables the 'selected' style from being applied from the list. An individual element's own style is used in that case.</em></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>UsePressedItemVisual</strong></td><td>bool</td><td><em>If set to false, disables the 'pressed' style from being applied from the list. An individual element's own style is used in that case.</em></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>UseDisabledItemVisual</strong></td><td>bool</td><td><em>If set to false, disables the 'pressed' style from being applied from the list. An individual element's own style is used in that case.</em></td></tr><tr><td><strong>DisabledTextSize</strong></td><td>Vector3</td><td></td></tr><tr><td><strong>DisabledTextMaterial</strong></td><td>Material</td><td></td></tr><tr><td><strong>DisabledBackgroundMaterial</strong></td><td>Material</td><td></td></tr></tbody></table>

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

<table data-full-width="true"><thead><tr><th width="286.3333333333333">Variable</th><th>Description</th></tr></thead><tbody><tr><td><strong>UpdateStyle</strong> ()</td><td><em>Updates the style options of all child UI elements.</em></td></tr></tbody></table>

## [*<mark style="color:yellow;">Modules</mark>*](https://app.gitbook.com/o/INXd6O7U3HTOyPr0N5Cw/s/iuxt6rCD029QGTuhMG79/)

*Note: The term "unselect" here is used instead of "normal" like style states because these modules are not called when the list items enter the normal first time, but instead, enter a "normal" state after being "selected".*

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

<table data-full-width="true"><thead><tr><th width="411.3333333333333">Variable</th><th width="164">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>useModules</strong></td><td>bool</td><td><em>If set to false, disables all modules on this list.</em></td></tr><tr><td><strong>ignoreChildModules</strong></td><td>bool</td><td><em>If set to false, disables all modules on the list items like buttons.</em></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>unSelectedModuleContainers</strong></td><td><a href="https://app.gitbook.com/s/iuxt6rCD029QGTuhMG79/module-container">ModuleContainer</a></td><td></td></tr><tr><td><strong>applyUnSelectedModuleContainers</strong></td><td>bool</td><td></td></tr><tr><td><strong>ignoreChildUnSelectedModuleContainers</strong></td><td>bool</td><td><em>If set to true, if any child element like buttons have Un-Select Modules, they are ignored.</em></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>selectedModuleContainers</strong></td><td><a href="https://app.gitbook.com/s/iuxt6rCD029QGTuhMG79/module-container">ModuleContainer</a></td><td></td></tr><tr><td><strong>applySelectedModuleContainers</strong></td><td>bool</td><td></td></tr><tr><td><strong>ignoreChildSelectedModuleContainers</strong></td><td>bool</td><td><em>If set to true, if any child element like buttons have selected Modules, they are ignored.</em></td></tr><tr><td></td><td></td><td></td></tr><tr><td><strong>beingPressedModuleContainers</strong></td><td><a href="https://app.gitbook.com/s/iuxt6rCD029QGTuhMG79/module-container">ModuleContainer</a></td><td></td></tr><tr><td><strong>ignoreChildUnSelectedModuleContainers</strong></td><td>bool</td><td></td></tr><tr><td><strong>ignoreChildBeingPressedModuleContainers</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://app.gitbook.com/s/iuxt6rCD029QGTuhMG79/module-container">ModuleContainer</a></td><td></td></tr><tr><td><strong>applyPressCompleteModuleContainers</strong></td><td>bool</td><td></td></tr><tr><td><strong>ignoreChildPressCompleteModuleContainers</strong></td><td>bool</td><td></td></tr></tbody></table>

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

<table data-full-width="true"><thead><tr><th width="430.3333333333333">Variable</th><th>Description</th></tr></thead><tbody><tr><td><strong>EmptyEffect</strong>(<em>List&#x3C;</em><a href="https://app.gitbook.com/s/iuxt6rCD029QGTuhMG79/module-container"><em>ModuleContainer</em></a><em>></em> <strong>moduleList</strong>)</td><td><em>Adds a new empty module container to the ModuleContainer list passed as a parameter.</em></td></tr></tbody></table>

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

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

<table data-full-width="true"><thead><tr><th width="430.3333333333333">Variable</th><th>Description</th></tr></thead><tbody><tr><td><strong>ScrollUp ()</strong></td><td></td></tr><tr><td><strong>ScrollDown</strong> ()</td><td></td></tr><tr><td><strong>ScrollLeft</strong> ()</td><td>For <a href="../horizontal-selector">Horizontal Selector</a> or <a href="../slider">Sliders/Progressbars</a></td></tr><tr><td><strong>ScrollRight</strong> ()</td><td>For <a href="../horizontal-selector">Horizontal Selector</a> or <a href="../slider">Sliders/Progressbars</a></td></tr></tbody></table>

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

### *<mark style="color:orange;">v4.0.3</mark> (June 2, 2023)*

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

1. *`onSelectModuleContainers` to `selectedModuleContainers`*
2. *`applyOnSelectModuleContainers` to `applySelectModuleContainers`*
3. *`ignoreChildOnSelectModuleContainers`  to `ignoreChildSelectedModuleContainers`*

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

1. *`onPressModuleContainers` to `beingPressedModuleContainers`*
2. *`applyOnPressModuleContainers` to `applyBeingPressedModuleContainers`*
3. *`ignoreChildOnPressModuleContainers` to `ignoreChildBeingPressedModuleContainers`*

*Renamed "**onClick"** to "**pressComplete"** for clarity about what it does.*&#x20;

1. `onClickModuleContainers` to `pressCompleteModuleContainers`
2. `applyOnClickModuleContainers` to `applyPressCompleteModuleContainers`
3. `ignoreChildOnClickModuleContainers` to `ignoreChildPressCompleteModuleContainers`

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

1. `unSelectModuleContainers` to `unSelectedModuleContainers`
2. `applyUnSelectModuleContainers` to `applyUnSelectedModuleContainers`
3. `ignoreChildUnSelectModuleContainers` to `ignoreChildUnSelectedModuleContainers`

<br>
