---
description: Legacy Documentation
---

# Modular 3D text

## How to use

:white\_check\_mark:Right click in scene hierarchy,\
&#x20;                _**3D Objects > Modular 3D Text > Anything**_\


![](https://4267301383-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M93198UjZ9RXuTCDVS_%2F-Mac5CYpZ-xEwlxiIgHI%2F-Mac6SfiRL0ELbUjn8Wq%2Fimage.png?alt=media\&token=65b6cebe-200c-4cfb-b5c2-d0567e635454)

## Important Note

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

{% hint style="info" %}
There is a asset window in Tools > Tiny Giant Studio where you can find  a lot of useful tools and information.
{% endhint %}

![Asset Window](https://4267301383-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M93198UjZ9RXuTCDVS_%2F-M93w1lggVabGPT46RGS%2F-M93wKW4evfGODb-N01_%2Fimage.png?alt=media\&token=26d68e90-5356-4fc4-a274-d861092c4786)

## Suggestions

:white\_check\_mark:Turn on **pooling** if a lot of text is changed in play mode. This option is under advanced settings on texts.\
:white\_check\_mark:Check tool-tips

## Modules/Effects

Drag & Drop Modules make it easy to add effects/animation. \
Modules are tiny Scriptable objects primary used to animate, Add/remove components etc.

![](https://4267301383-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M93198UjZ9RXuTCDVS_%2F-Mag05udRM6okP9xTHhH%2F-Mag6XwUkOnv_VQcQdeR%2Fimage.png?alt=media\&token=ca1b53fe-9855-4939-b881-6f5788b1607e)

:white\_check\_mark:Effects will only apply in play mode & **if** the text object is active/enabled.\
:white\_check\_mark:Combined mesh can’t have effects.\
:white\_check\_mark:When pooling is turned on If you use “_**Add Gravity”/”Add rigidbody**_” in typing effects, \
use “_**Remove Gravity”/”Remove rigidbody**_” on deleting effects. This makes sure objects don’t have pre-added components when reusing them through the pool. \
:white\_check\_mark:**There are more settings in the Modules itself. Check them out.** \
**Example:** You can add a bouncy physics material in the rigid-body module, a curve to choose how the scale change will happen.

###

### **Module Creation**

To create a module, create a script like the example below, create an item for that module and assign the module in text to use.

#### Example module script

```csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace MText
{
   [CreateAssetMenu(menuName = "Modular 3d Text/Modules/Your effect name goes here")]
   public class YourFileNameGoesHere : MText_Effect
   {
      public override IEnumerator ModuleRoutine(GameObject obj, float duration)
      {
         //enter your code here
         //Do something with the object
         yield return null;
      }
   }
}
```

Here, _**`obj`**_ is the _**`gameObject`**_ of the character being typed and duration is the value passed from the individual text.

After creating the script, right click in the project window, click \
&#x20;      “_Create > Modular 3d Text > Modules > Your effect name goes here_”.

## 3D UI System

One object with _**`MText_UI_RaycastSelector`**_ script attached needs to be in the scene to select items with mouse/touch. You can disable it when not using a 3D UI. This is automatically added when you create a 3d UI item (except plain text).

**If no camera is selected for `MText_UI_RaycastSelector`, Camera.Main is used to assign camera in Start();** \
If not camera main is found and no camera is referenced in the inspector, the touch control/mouse control won't work.

### **Text**

&#x20;✅ If _**`UpdateOncePerFrame`**_&#x73;etting is turned on, which is on by default, texts are updated at the end of the frame. This makes sure multiple calls/changes to the text doesn't unnecessarily update the text multiple times in a single frame. If you need the text to be updated instantly, call _**`UpdateText();`**_

### **List**

:white\_check\_mark:_**In play-mode/build,  call`UpdateList()` to update the list.**_\
:white\_check\_mark:Don’t forget to turn on the keyboard control for that to work..\
:white\_check\_mark:You can turn on/off each individual component like **Selected style.**

### &#x20;**Button**

:white\_check\_mark:Remember, the size of the Box-collider on the component itself determines if you are hovering/clicking on it, not the background size.\
:white\_check\_mark:Some usefule methods:\
&#xNAN;_**`SelectButton()`**_ , _**`UnselectButton()`**_, _**`PressButton()`**_, _**`Uninteractable()`**_, _**`Interactable()`**_

### **Toggle**

:white\_check\_mark: Toggle relies on Button to call _**`Toggle()`**_&#x77;hich is automatically added when creating toggle

### **3D Input Field**

:white\_check\_mark: Difference between Select() and Focus() is select checks if the input field is in a list then if it's in a list, selects it.

### **3D Slider**

:white\_check\_mark: **UpdateValue**(int newValue)/ **UpdateValue**(float newValue) use these to update slider via code.

## Creating fonts

### In Editor

(Video Tutorial:[ https://youtu.be/m9JwBc-0DUA](https://youtu.be/m9JwBc-0DUA))

‌\[Supports only TTF file formats. Most fonts found online are in TTF format]\
Note: the asset doesn't support right to left/top to down languages yet

1\. Go to _Tools > Tiny Giant Studios > Modular 3D Text_

![](https://4267301383-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M93198UjZ9RXuTCDVS_%2F-MQK63U_Nn0bwm63sQvD%2F-MQK6BNgPiFgqxxupgaF%2Fimage.png?alt=media\&token=4cda1ebf-8849-4b1e-bdbf-9ba8af1986be)

‌2. Select Font Creation Tab and click Create Font

![](https://4267301383-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M93198UjZ9RXuTCDVS_%2F-MQK63U_Nn0bwm63sQvD%2F-MQK6TG9IQrKlVQMyflL%2Fimage.png?alt=media\&token=0752e7a5-d03d-4ea1-8729-33d5df77fd61)

3\. Select your font file from anywhere in the computer‌

4\. Give a few seconds to process and then select location inside your project where your mesh/font will be saved.‌

5\. Right click in the project window, **Create > Modular 3d Text>New font**.

![](https://4267301383-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M93198UjZ9RXuTCDVS_%2F-MAWnDoQal1fjgQdt3X2%2F-MAWnn5NhxNHQqzVv08g%2Fimage.png?alt=media\&token=ee2d5c99-4483-4b6d-89a9-a3c5256d2258)

6\. Assign exported FBX file to the font. Click the create/recreate button.

![](https://4267301383-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M93198UjZ9RXuTCDVS_%2F-MAWnDoQal1fjgQdt3X2%2F-MAWo9aUf-ga6RJdgx0V%2Fimage.png?alt=media\&token=90f14a27-8664-4a43-b4ef-f3825b9f1a0f)

Your font is ready to be used.

‌

{% hint style="info" %}
Remember, the ttf font must have the characters in the first place to create 3D version.

There is a limit of how many meshes unity can handle per asset. Although the limit is pretty high, it gets slow in editor when you select that object after about a thousand mesh. If you need more characters, I suggest separating them into smaller chunks and having them set as Fallback fonts.
{% endhint %}



### For different Languages

(Video tutorial:[ https://youtu.be/JN\_DSmdiRSI](https://youtu.be/JN_DSmdiRSI))

‌Before creating the font, Click the Get Character List Button which will take you to[ https://unicode-table.com/en/#control-character](https://unicode-table.com/en/#control-character) In character range, for your language, from the link , enter the first character and the last character. This will make the created font include every character inbetween them. Then, Click create font.

### &#x20;**Using blender**

(Video tutorial : [https://youtu.be/lbRe4-wlf74](https://youtu.be/lbRe4-wlf74))

1. **Install blender** if you don’t have it already.
2. **Open the font extractor folder** inside the modular 3d text folder. (Unzip it)
3. **Open the blender file**.
4. Click **run script**.
5. **Select extract font** from the left toolbar
6. **Select your font**.
7. Do any changes you want in this step, like retopology, optimization (Check for optimization tips below) according to your needs. Or just skip this step if you want.
8. File>Export>**Export as FBX** to your project. Default export settings are fine.
9. In unity, right click in the project window, **Create > Modular 3d Text>New font**.
10. **Assign exported FBX file to the font. Click the create/recreate button**.
11. **Font is ready to use**.

**Optimization:**

(To people who are knowledgeable about optimization, do your own thing. This is just a fast and simple way to do things, not perfect.)\
The font created in blender is not optimized. Didn't include auto-optimization in blender script because some fonts have very different geometry than expected from an average font which would result in losing details or not enough optimization.\
To reduce vertices. A fast but not the best way to optimize it would be,

1. Select all objects (Press A in scene view).
2. Press Tab to enter edit mode. (If you can't enter edit, select and deselect an object by left clicking one and then, an empty area, Select everything again (Press A) then Press Tab to enter edit mode)
3. Go to the Mesh menu (on the top menus on view window)
4. Cleanup > Limited Dissolve.
5. Cleanup > Remove doubles.

This can reduce a lot of unnecessary vertex but sometimes result in few characters having strange geometry. You can Undo & deselect the objects with problematic geometry.\
If the font looks good enough, export and use.

### Manual Slow way:

* In unity, right click in the project window, Create>Modular 3d Text>New Font.
* In the list you see after selecting the font, add a new item. Assign any object you want to that item and type a character for it besides it. Now when you type the character in, that object is used.

Fix positioning + Rotation + scaling for the font. You can fix it for all the characters at once by specifying it in the font file and + or you can assign a parent to the object, add “MText\_Character.cs” component to the parent and fix transform for each character individually. That script shows the default expected scale and size.

## About the included examples

![](https://4267301383-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Ftinygiantstudios%2F-M931T6lz3kUSvC16O5S%2F-M932LPI0DcpEMh3iGyw%2F11.png?generation=1591353372457088\&alt=media)

![](https://4267301383-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Ftinygiantstudios%2F-M931T6lz3kUSvC16O5S%2F-M932LPJD6FD2-qslO4c%2F12.png?generation=1591353372430750\&alt=media)

Speed and volume’s x and y value are the minimum and maximum value. Keep them the same if you don’t like them to fluctuate. A little randomization makes them feel natural.

**StatusToolTip script:**\
You can use one for the entire scene. The pool for it is separate from Text. \
Example usage: Status debuff/buff in RPG, damage UI\
Just call the method ShowToolTip()

If nothing is selected, the _selectedItem int_ will return the size of the list or 0.&#x20;

