Super Text Mesh Documentation

Table of Contents


  1. Adding Super Text Mesh to Unity
  2. Text Data File & Rich Text Tags
  3. Functions, Variables & Events
  4. Shaders & Shadows
  5. Utilities

Notes ChangeLog Credits


1. Adding Super Text Mesh to Unity

a. Importing Super Text Mesh into Unity

Recommended minimum install.

To import Super Text Mesh into your project, either drag in the .unitypackage file, or get it from the asset store window.

Imported folders, what they do, and if you need to import them or not, alphabetically:

Additional support packages are listed under Support Packages for Other Assets.

The outline shaders take a long time to compile, so don't import them if you're in a hurry or don't want to use them.

b. Adding Super Text Mesh to a Scene

Adding as a new Game Object.

To add it as a new GameObject, you can also go "GameObject > 3D Object > Super 3D Text", to create a new Text Mesh object. This option may require a reset of Unity to appear, initially. "GameObject > UI > Super Text" is the path for adding a new UI Text object. Please do not add Super Text Mesh to your game by dragging in the prefabs from the "prefabs" folder. Those only exist so adding it from the GameObject menu can work!

To add Super Text Mesh to an existing object in your project, you can select "Add Component" on an existing GameObject and find it under "Mesh > Super Text Mesh". Even when adding it as a UI element, you can add it this way, as long as the object you're adding it to is already the child of a canvas (if it has a RectTransform).

2. Text Data File & Rich Text Tags

a. Text Data

The inspector window.

In "Assets > Clavian > SuperTextMesh > Resources", you'll find a set of files used to change the presets of all text meshes in your project. You can edit these directly here, or click on the "[T]" icon in any Super Text Mesh's inspector to edit them with a custom inspector!

This file allows customization of effects called by Super Text Mesh's rich text tags. For example, you can define a color named "1" to be called with the tag <c=1>, or a text delay to be called using <d=myDelay> so you wouldn't have to type the same number over and over to call the same effect.

b. Text Data Customization

Lots of Super Text Mesh's settings can be changed mid-strin`g with tags such as <c=red> to change text to be red, or <d=10> to insert a delay that would be equal to 10 characters being read out. Most tags can be customized in a group of assets referred to as "TextData". All TextData files can be found within "Assets > Clavian > SuperTextMesh > Resources" and can be edited there, or by clicking the [T] icon within a Super Text Mesh component. The name of the file will determine what tag it uses (eg. A color named "Teal" would be called with <c=Teal>). When editing in the Super Text Mesh inspector, each TextData file has a header with a button to ping the asset in the project folder, a button to delete it, and a bar where the name can be edited. At the bottom of each group is a button to create a new asset, and at the very bottom of the inspector is a button to refresh the database, incase you make assets outside of the inspector. Waves, Jitters, and Delays all have customizable default settings. When you go to edit them, you'll notice a setting named "default". This will be the setting called by the basic version of this tag. (<w>, <j>, <d>.) These can be changed to whatever settings you want. In other words, using the <w> tag would be the same as calling <w=default>.

For autodelays and autoclips, you might want to have a delay or a clip inserted for a character that can't be saved in a file name, such as "?", "!", ".", etc. For these, use the written-out name of these characters instead: "space", "tab", "line break", "exclamation point", "question mark", "semicolon", "colon", "tilde", "period", "comma", "number sign", "percent", "ampersand", "asterix", "backslash", "forwardslash", "openbrace", "closebrace"

Other aspects of Super Text Mesh, like draw animations, automatic voice clips, and master switches are also controlled with these text data files.

c. Rich Text Tags

Demonstration of some tags.

These tags can be used mid-string to change aspects of the text! Any tag that has "name" on it like "<c=name>" can be modified with the Text Data file. All tags can be closed with a tag like "</c>", for example.

Other elements of Super Text Mesh can be changed directly with tags, but these are meant to be changed with voice tags, as they are longer than standard tags. Still, you can use them in regular text, too:

3. Functions, Variables & Events

a. Public Functions

These functions can be called with code, and are most useful for dialogue managers:

b. Public Variables

All public variables can be changed with code, if needed.







Extra Stuff

In the sample project, there's a simple dialogue manager script that shows off how to use some of these functions and variables.

c. UnityEvents

Events from the sample scene.

Unity Events call a list of component methods via the Unity Event System.

You can tell a function to be called when a certain event happens, by dragging in the GameObject & function in the Unity editor.

On Rebuild Event ()

Invoked when Rebuild() is called. Good for custom events, like clearing generated particles or colliders.

On Complete Event ()

Invoked when a text mesh is finished writing out text.

On Undrawn Event ()

Invoked when a text mesh finishes its undrawing animation.

Custom Event (string, TextInfo)

Invoked with the event tag (<e=myString> / <e2=myString>). Passes an argument that has a string, and the TextInfo attached to the letter. The string is the "tag" written with the event. ("myString", in this case) TextInfo is an internal class used by Super Text mesh that contains all kinds of data about letters in a mesh like size & position. Here's some basics of the TextInfo class that you can use to reposition letters:

You can check out "TextMeshData.cs" to have a look at the complete code for this class!

Using the tag (<e=helloWorld>) mid-string could be used to invoke a function like this:

void MyFunction(string myString, int letterIndex, Vector3 letterMiddle, Vector3 letterCorner){
    Debug.Log(myString); //prints "helloWorld"
    Debug.Log(letterIndex); //prints index of letter event was attached to
    Debug.Log(letterMiddle); //prints world position of letter

Check out "STMEventInterpreter" in the "Sample" folder, for an example of how to use this. The "TextMeshExample" scene has a few examples that use this, as well as common uses for it.

Vertex Mod (Vector3[], Vector3[], Vector3[])

Vertex Mod in action.

Not a typical event like the rest, this event is used to modify the vertices of an entire mesh. To use it, under the "Position" foldout enable "modify vertices" and the event dialogue will appear. The kind of event you'll want to call would be laid out like this:

void ChangeVertices (Vector3[] verts, Vector3[] middles, Vector3[] positions){
    for(int i = 0; i < allMeshVertices.Length / 4; i++){
        //change a letter's verts:
        verts[4 * i + 0] += Vector3.right;
        verts[4 * i + 1] += Vector3.right;
        verts[4 * i + 2] += Vector3.right;
        verts[4 * i + 3] += Vector3.right;
        //move all to the right         Debug.Log(middles[i]); //middle of this letter
        Debug.Log(positions[i]); //position of this letter

An included example script named "STMVertexMod" shows a few basic modifications you can do to a text mesh. (In the sample scene, look for an object named "CurvedTextSample" to see it in action)

Make sure when adding a new event to select "Editor and Runtime" from the event dropdown so you can see changes made in-editor.

4. Shaders & Shadows

a. Changing Shaders & Included Shaders

You can drag a new shader onto the "text shader" area to change that. The included shaders are the only ones supported, currently. You can find them in "Assets > Clavian > SuperTextMesh > Shaders".

b. Clues for Writing Custom Shaders

c. Enabling Shadowcasting

To toggle Super Text Mesh's shadow casting, check out the "Shadow Casting Mode" dropdown under the "appearance" section!

d. Outlines and Dropshadows

To use outlines or drop shadows, drag the "Unlit Dropshadow", "Unlit Outline", or "Unlit DropshadowAndOutline" shaders from the "Shaders" folder into the "shader" varaible on Super Text Mesh. After this, an additional header labelled "Shader" will appear in the inspector. You can use this to set how the dropshadow and outline look!

e. SDF Fonts

To use the "SDF Unlit Outline" shader, you will first have to convert an existing font to an SDF font, using an external SDF texture generator. I use SDF Toolkit Free by Catlike Coding, and this guide will involve how to set up an SDF font using this. Please consider getting the paid version to support Jasper, who let me write this up for you!

Now you have super-crisp SDF text in your game! Enjoy!

5. Utilities

a. Curve Generator

The "New" button in the curve dialogue.

Within "Assets > Clavian > SuperTextMesh > Utility", you'll find a script named "STMCurveGenerator". This script is meant to generate curves that are pretty common for waves. To use it, drag it onto any Game Object in your project, then click on one of the curves to open up the curve editor. From there, you can click the gear in the bottom left to save the curve into Unity as a preset! Then you can use it again for other curve fields, like the ones on waves and jitters.

b. Support Packages for Other Assets

There are additional tools that assist with setting up Super Text Mesh with other Unity assets that others have coded. Linking them here, but I cannot provide direct support for these.

Other assets that can be used in conjunction with Super Text Mesh, but weren't written specifically for it:


Known Bugs

Planned Features / To Do List:


















Coding and design by Kai Clavier (@KaiClavier)
Extra CSS help by Tak (@takorii)