# Script references

{% hint style="info" %}
**All scripts are in namespace MText. So, don’t forget to add** _`using MText`_ **on top of the script when referencing scripts on this asset.**
{% endhint %}

### **Modular3DText.cs**

| **Method/variable**                           |      **Type**     | **Description**                                                                                                                                                                                                |
| --------------------------------------------- | :---------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`Text`**                                    |       String      | Text string of the 3D text                                                                                                                                                                                     |
| **`Material`**                                |      material     |                                                                                                                                                                                                                |
| **`FontSize`**                                |      vector3      |                                                                                                                                                                                                                |
| **`CharacterSpacing`**                        |       float       |                                                                                                                                                                                                                |
| **`LineSpacing`**                             |       float       |                                                                                                                                                                                                                |
| **`Width`**                                   |       float       |                                                                                                                                                                                                                |
| **`Height`**                                  |       float       |                                                                                                                                                                                                                |
| **`Capitalize`**                              |        bool       |                                                                                                                                                                                                                |
| **`LowerCase`**                               |        bool       |                                                                                                                                                                                                                |
| **`pooling`**                                 |        bool       | Enables/Disables the usage of pooling                                                                                                                                                                          |
| **`EmptyEffect`**`(List <effect> effectList)` |       Method      | To add new effects runtime, Call this method and pass it typingEffects or deletingEffects. This will create a new empty effect slot. Assign a Module and duration to it.                                       |
| `TextAnchor`                                  |     TextAnchor    | Sets the alignment of the 3D text                                                                                                                                                                              |
| **`assetPath`**                               |       string      | <p>Where the prefab is saved.</p><p>Is only used when prefab connection is broken via <em>break prefab connection</em> button in Advanced Settings to store the path to be used by reconnect prefab button</p> |
| **`characterObjectList`**                     | List\<GameObject> | List of character objects created by the text                                                                                                                                                                  |

Modifiable attributes via script: _material_, _characterSpacingInput_ for character spacing, _lineSpacingInput_ for line spacing, height, length

###

### **MText\_Font.cs**

| Method/variable                | Type                                 | Description                                                                                                                     |
| ------------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| **`RetrievePrefab`**`(char c)` | Method                               | Returns prefab of the character. Returns null if nothing found                                                                  |
| **`monoSpaceFont`**            | Bool                                 | Mono space fonts are fonts with equal distance to each character. For example, the character ‘I’ will occupy same space as ‘A’. |
| **`Spacing`**`(char c)`        | Method                               | Returns the area (spacing) a character will occupy in non-mono spaced font.                                                     |
| **`characters`**               | <p>List of</p><p>MText_Character</p> | Each MText\_Character has a character, prefab and spacing information                                                           |
| **`monoSpaceFont`**            | bool                                 | True = all characters are equal distance to each other                                                                          |
| **`emptySpaceSpacing`**        | Float                                | How large of an area should empty space be taking                                                                               |

###

### **MText\_UI\_List.cs**

| Method/variable                                     | Type   | Description                                                                                                                                                                                                                           |
| --------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`UpdateList`**()                                  | Method | Repositions list items                                                                                                                                                                                                                |
| **`Focus`**`(bool enable)`                          | Method | <p>Makes list active or deactive to keyboard controls.</p><p>Enabling focus has a one frame delay.This is to avoid pressing “Enter” in one list, enabling another list which also takes the “Enter” input and presses it’s button</p> |
| **`Focus`**`(bool enable, bool delay)`              | Method | Makes list active or deactive to keyboard controls without delay if second parameter is set to false.                                                                                                                                 |
| **`SelectItem`**` ``(int i`)                        | Method | Selects i number child                                                                                                                                                                                                                |
| **`UnSelectSpecific`**` ``(MText_UI_Button button)` | Method | Unselects button graphic                                                                                                                                                                                                              |
| **`UnselectEverything`**` ``()`                     | Method | Unselects everything                                                                                                                                                                                                                  |

###

### **Mtext\_UI\_InputField**

|                                                                                                                                                                  | Type          | Description                                                                        |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------- |
| **`Text`**                                                                                                                                                       | string        | Current input                                                                      |
| **`Focus(bool enable)`**                                                                                                                                         | method        | Enables/Disables input. Enabling has a one frame delay                             |
| **`Focus`**`(bool enable, bool delay)`                                                                                                                           | Method        | Enables/Disables input. Enabling delay depends on second parameter.                |
| **`background`**                                                                                                                                                 | Renderer      | Background. That’s all Folks!                                                      |
| **`inFocusBackgroundMat`**                                                                                                                                       | Material      | Material assigned to background when input is active                               |
| **`onInput`**                                                                                                                                                    | Unity Event   | Events are called when a new character is added,                                   |
| **`onBackSpace`**                                                                                                                                                | Unity Event   | Events are called when a character is removed                                      |
| **`onInputEnd`**                                                                                                                                                 | Unity Event   | Called when input is complete. Dictated by Enter key                               |
| **`InputComplete()`**                                                                                                                                            | Method        | Completes input, invokes oninputEnd                                                |
| **`interactable`**                                                                                                                                               | Bool          | Will touch/click enable it or selectable in a list                                 |
| **`text`**                                                                                                                                                       | Modular3DText | The text object for this input                                                     |
| <p><strong><code>SelectedVisual()</code></strong></p><p><strong><code>UnselectedVisual()</code></strong></p><p><strong><code>DisableVisual()</code></strong></p> | Method        | Sets the visual style                                                              |
| **`Uninteractable()`**                                                                                                                                           | Method        | Disables interaction                                                               |
| **`Interactable`**`()`                                                                                                                                           | Method        | Enables interaction                                                                |
| _**`UpdateText`**`()`_, _**`UpdateText`**`(string)`_, _**`UpdateText`**`(int)`_, _**`UpdateText`**`(float)`_                                                     | Method        | <p>Updates Text.</p><p>Updating the "Text" variable directly also updates them</p> |

### **MText\_UI\_Button**

| Method/variable                                                                                                                                                                                                                                                     | Type   | Description                                        |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------- |
| **`PressButton`**`()`                                                                                                                                                                                                                                               | Method | Presses the button                                 |
| **`SelectButton()`**                                                                                                                                                                                                                                                | Method | Selects the button                                 |
| <p><strong><code>UnselectedButtonVisualUpdate()</code></strong></p><p><strong><code>PressButtonVisualUpdate()</code></strong></p><p><strong><code>SelectedButtonVisualUpdate()</code></strong></p><p><strong><code>DisabledButtonVisualUpdate()</code></strong></p> | Method | Applies style to graphic only. No function change. |
| **`Uninteractable()`**                                                                                                                                                                                                                                              | Method | Disables interaction                               |
| **`Interactable`**`()`                                                                                                                                                                                                                                              | Method | Enables interaction                                |
| _**`LoadDefaultSettings()`**_                                                                                                                                                                                                                                       | Method | Resets button settings from Settings file          |

Some modifiable properties like normalBackgroundMaterial, pressedBackgroundMaterial, selectedBackgroundMaterial etc.

### **MText\_UI\_Toggle**

| Method/variable                                                                                                       | Type   | Description                                                                                  |
| --------------------------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------- |
| **`IsOn`**                                                                                                            | bool   | As the name suggests.                                                                        |
| **`Set`**` ``(bool)`                                                                                                  | Method | Specificly set the toggle                                                                    |
| **`Toggle ()`**                                                                                                       | Method | Toggles the toggle.                                                                          |
| <p><strong><code>ActiveVisualUpdate(),</code></strong></p><p><strong><code>InactiveVisualUpdate()</code></strong></p> | Method | Applies just the style. Setting the **`IsOn`**&#x77;ill automatically update the visual too. |

Toggle is controlled by button. Set button‘s interactable property to control toggle

###

### **MText\_UI\_Slider**

| Method/variable                                                                                                                                                                                                       | Type   | Description                                    |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------------------------------------------- |
| **`Focus`**`(bool enable)`                                                                                                                                                                                            | Method | Enables/Disables slider to mouse/touch control |
| <p><strong><code>UpdateValue</code></strong><code>(int newValue)</code></p><p><strong><code>UpdateValue</code></strong><code>(float newValue)</code></p>                                                              | Method | Use it to update slider value                  |
| <p><strong><code>SelectedVisual()</code></strong></p><p><strong><code>UnSelectedVisual()</code></strong></p><p><strong><code>ClickedVisual()</code></strong></p><p><strong><code>DisabledVisual()</code></strong></p> | Method | Updates the visual of the slider               |
| **`Uninteractable()`**                                                                                                                                                                                                | Method | Disables interaction                           |
| **`Interactable()`**                                                                                                                                                                                                  | Method | Enables interaction                            |



### **HorizontalSelector**

| **Variable**               | **Type**      | **Description**                            |
| -------------------------- | ------------- | ------------------------------------------ |
| **text**                   | Modular3DText | The 3D text used to show the current value |
| **selected**               | bool          |                                            |
| **interactable**           | bool          |                                            |
| **options**                | string list   | Options available for the selector         |
| **value**                  | int           |                                            |
| **keyboardControl**        | bool          |                                            |
| **increaseKey**            | KeyCode       |                                            |
| **decreaseKey**            | KeyCode       |                                            |
| **valueChangeSoundEffect** | AudioClip     |                                            |
| **audioSource**            | AudioSource   |                                            |
| **onValueChangedEvent**    | UnityEvent    |                                            |
| **onSelectEvent**          | UnityEvent    |                                            |

| **Method**   | **Description**                          |
| ------------ | ---------------------------------------- |
| **Increase** | Increases currently selected number by 1 |
| **Decrease** | Decreases currently selected number by 1 |



**Note**: Nothing in the `MText.FontCreation` namespace is meant to be used by anything other than what it does already. The code is quiet messy and hard to provide support for since I am not very knowledgeable about mesh genaration. So, wrapping it in a DLL. Will slowly organize stuff and move some pieces of them out of DLL one by one later. if I have the time. (Low priority). \
Update to 1.4.2: moved most code out of DLL. (mesh+obj exporter, different helper scripts) Just triangulation script is in DLL.

## API Change-list

\[This is not asset version change list. It is just API change.]\
**Version 2.0.0**\
Most public text variables are properties now, will auto update the text if changed.

**Version 1.6.9**\
1\. Input String has been renamed to input field\
2\. Toggle's "active" variable has been renamed to "isOn" to match with Unity's UI.\
3\. Toggle's active & inactive item is game-object now, instead of a list.

**Version 1.6.5**\
`UpdateText()` now updates the text no matter what. Use `UpdateTextWithCheck()` if you want to update if change is made to the tracked properties.

**Version 1.5.03**&#x20;

1. Modular 3D Text:\
   NewEffect(the list to add module to, new module); method \
   ClearAllEffects();
2. StatusToolTip script replaces DamageText script to be used in a real scenerio instead of just as a sample

**Version 1.4.02**

1. Few more scripts are out of DLL.&#x20;
2. In-editor font creator can export font as mesh instead of OBJ too and the scripts are out of DLL. They aren't really useful for anything outside of font creation. Not putting them in Scripting references to avoid clutter.

**Version 1.4.01**

1. Slider Value range events have been added
2. Text has new `bool activateChildObjects`. This creates child characters as inactive.

**Version 1.4.0**

1. bool useUpperCaseLettersIfLowerCaseIsMissing added to Font class. Does what it says.
2. Nothing in the MText.FontCreation namespace is meant to be used by anything other than what it does already. The code is quiet messy and hard to provide support for. So, wrapping it in a DLL. Will slowly organize stuff and move out of DLL one by one.

**Version 1.3.23**

1. Slider & Input string visual update methods now take style options from List just like buttons
2. _`PressButtonDontCallList()`_ is a new method to press a button without calling the parent list. Primarily used by List itself to avoid recursive calls by _`PressButton()`_
3. InputField now has public _`UpdateText()`_, _`UpdateText(string)`_, _`UpdateText(int)`_, _`UpdateText(float)`_
4. _`Modular3DText.cs` &&_ `MText_UI_Button` now has a _`LoadDefaultSettings()`_ method that does what it says.
