Super Text Mesh Documentation
	






Features


Adding Super Text Mesh to Unity

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 and what they do

Additional support packages are listed under [Support Packages for Other Assets](#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.

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


Text Data File & Rich Text Tags

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.

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"

You can also reference quads this way! If you have a quad named "cross", then when you type <q=cross> into a mesh, it'll react to autodelays, autoclips, and sound clips named "cross".

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

Effects

Waves

[<w> / <w=name>]


Editing a wave.

Jitters

[<j> / <j=name>]

Draw Animations

[<drawAnim=name>]

The initial draw animation of a mesh is defined in the inspector, but can be changed mid-string with tags. Draw animations are also used in reverse for undrawing animations. They are referenced with case-sensitive strings.

Text Color

Colors

[<c> / <c=name>]

Define colours by name to be called by the <c=name> tag.

Gradients

[<c> / <c=name>]

Define a gradient to be called by the <c=name> tag.

Textures

[<c> / <c=name>]

Define a texture to color text with. Also called with the <c=name> tag.

Inline

Delays

[<d> / <d=name>]

Delays can be defined here, to be called back quickly using tags instead of numbers.

Voices

[<v> / <v=name>]

Define longer strings that can be inserted with shorter ones, called by <v=name>. Good for setting multiple things at once, and defining different settings for characters. The usage is similar to text macros.

Fonts

[<f> / <f=name>]

You can define a font to be called with the <f=name> tag, here.

Audio Clips

[<audioClips=name>]

Changes the set of audio clips to be used.

Sound Clips

[<clips=name>]

Adds a set of auto clips to be used. For adding auto clips mid-string.

Quads

[<q=name> / <q=name,index> / <q=name,xPos,yPos>]


How quad columns work.
Used to define quads, inline images that can be used in a similar fasion to emoji. When writing out the tags for quads, you can override the index or get a quad at a specific point in your texture if you don't want to define multiple quads in the inspector!

Materials

[<m=name>]

Defines materials to switch to mid-string.

Automatic

Auto Delays

Automatic delays that happen after specific characters can be defined, here. They only occur if the following character in a string is a space, tab or line break.

An auto delay will be inserted after its character is read out.

Auto Clips

Certain audio clips can be defined to play for specific characters, here. If "Clip" is undefined, a sound will NOT be played for this character. This is good for spaces, line breaks, and tabs, all of which are defined for this by default. This feature could also be used to set up a typewriter, so you can have it make the distinctive "ding" sound, every time a line break is read out.

Master

Disable Animated Text

For accessibility, you can use this bool to easily enable/disable ALL animated text effects in your game. To call it with code, you can use "SuperTextMesh.data.disableAnimatedText".

Default Font

This will be the font STM will fallback to. By default, this value is Arial, Unity's built-in font. It's only suggested to change this if you are having issues with Arial as a fallback, since the default font will be used if a character doesn't exist in a font and Arial seems to have every character Unity supports available.

Bounds Color

Controls the colour of STM's autoWrap/verticalLimit bounds gizmos. Set transparency to 0 to disable.

Text Bounds Color

Controls the colour of STM's text bounds gizmos. Set transparency to 0 to disable.

Bounds Color

Controls the colour of STM's final text bounds gizmos. Set transparency to 0 to disable.

Superscript Offset

How high superscript text (<sup>) will be relative to text.

Superscript Size

How big superscript text will be relative to text.

Subscript Offset

How high subscript text (<sub>) will be relative to text.

Subscript Size

How big subscript text will be relative to text.

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](#Text Data). 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:


Methods, Parameters & Events

Public Methods

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

Rebuild

void SuperTextMesh.Rebuild()

Call this to update the mesh's text. This will also cause it to read out again, if the read delay is above 0.

void SuperTextMesh.Rebuild(bool readAutomatically)

Can be used to rebuild the mesh without automatically reading out. Good for some text boxes. Will override the "autoRead" variable.

RebuildAll

[STATIC] void SuperTextMesh.RebuildAll()

Will call Rebuild() on every mesh in the scene. Should only be used when starting a scene as it uses FindObjectsOfType, which is very intensive.

Read

void SuperTextMesh.Read()

You can use this to have text get re-read without rebuilding the mesh.

void SuperTextMesh.Read(float startTime)

You can also get the mesh to read from a specific point.

SpeedRead

void SuperTextMesh.SpeedRead()

Tells the text mesh to switch to its faster reading speed.

RegularRead

void SuperTextMesh.RegularRead()

Tells the text mesh to return to its regular reading speed.

SkipToEnd

void SuperTextMesh.SkipToEnd()

Makes the mesh finish drawing immediately, calling all events that haven't been read yet.

Append

void SuperTextMesh.Append(string)

Add to the end of the current text mesh string, and begin reading from this point.

UnRead

void SuperTextMesh.UnRead()

Tell the mesh to play its "undrawing animation". Other aliases for this function are "Unread()", "UnDraw()", and "Undraw()". After the animation finishes, the mesh won't update until Rebuild() is called again.

Continue

bool SuperTextMesh.Continue()

Tells the mesh to continue past a <pause> tag. Will return true if any more pauses needed to be passed by, and false if the end of the mesh was already reached.

UndoContinue()

bool SuperTextMesh.Continue()

Makes text begin reading from the previous pause point used by Continue().

Public Properties

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

Text

text

string SuperTextMesh.text

Same as SuperTextMesh._text, but Rebuild() will be called automatically upon setting.

_text

string SuperTextMesh._text

This is the text stored within the text mesh. The text mesh will not display it until Rebuild() is called. There's an underscore there, by the way, it's just covered up by the underline.

drawText

[READ ONLY] string SuperTextMesh.drawText

Text that the mesh will display. So this is the same as SuperTextMesh.text, but after being processed as rich text! If rich text is turned off, this will be the same as SuperTextMesh.text. This string will not include automatically-inserted hypens and line breaks.

hyphenedText

[READ ONLY] string SuperTextMesh.hyphenedText

Text that the mesh will display, including characters that may have been added like hyphens and line breaks, and with some characters removed, such as spaces replaced by line breaks.

reading

[READ ONLY] bool SuperTextMesh.reading

This bool returns true if the text mesh is currently reading out text. Returns false when the mesh has finished, or if the mesh has a read delay of 0.

unreading

[READ ONLY] bool SuperTextMesh.unreading

This bool returns true if the text mesh is currently playing its unreading animation.

Appearance

font

Font SuperTextMesh.font

The font to be used by the text mesh.

color

Color SuperTextMesh.color

Default color used by this text mesh.

size

float SuperTextMesh.size

Size of this text in local space. For UI elements, this is the size in screen space.

bestFit

SuperTextMesh.BestFitMode SuperTextMesh.bestFit

Controls Best Fit text.

style

FontStyle SuperTextMesh.style

Default font style for the text mesh.

richText

bool SuperTextMesh.richText

If this text mesh responds to rich text tags or not.

quality

int SuperTextMesh.quality

This is a font's point size.

filterMode

FilterMode SuperTextMesh.filterMode

Filter mode to be used by the text mesh.

A note about filter modes! If two text meshes are using the same font, but with different filter modes applied, the material settings will get confused and blink between filter modes. I suggest duplicating your font in the assets folder and using the different filter mode on this new font to avoid this.

maskMode

SuperTextMesh.MaskMode SuperTextMesh.maskMode

What operation STM will use when masking.

textMaterial

Material SuperTextMesh.textMaterial


Material controls.
The default material being used by this mesh. Will be referenced by the mesh upon rebuild, and should be treated as "a shader, with settings". A good example of this is that if you had an in-game keyboard made up of several Super Text Meshes, they could all share the same material and changes could be made to all of them quickly this way.

NOTE: This value is only referenced once Rebuild() is called, where Super Text Mesh will then create an internal material that the mesh will reference instead. This is done so that multiple fonts can use the same material's look. So the above trick with changing a single material to effect multiple meshes only works in edit mode.

Position

baseOffset

Vector3 SuperTextMesh.baseOffset

Additional offset for the mesh from the anchor point.

relativeBaseOffset

bool SuperTextMesh.relativeBaseOffset

Changes whether baseOffset is multiplied by a letter's size or not. Z is not effected.

anchor

TextAnchor SuperTextMesh.anchor

Anchor point of the text box. In UI mode, upper/middle/lower anchors can be adjusted. This also controls where text will draw from if you have bounds defined. (Bottom-anchored text will snap to the bottom of your defined bounds.)

alignment

SuperTextMesh.Alignment SuperTextMesh.alignment

Decides text alignment.

lineSpacing

float SuperTextMesh.lineSpacing

The space between rows of text. 1 is the default.

characterSpacing

float SuperTextMesh.characterSpacing

Extra horizontal space between characters. Default is 0.

tabSize

float SuperTextMesh.tabSize

The width that a tab should take up. Default is 4.

autoWrap

float SuperTextMesh.autoWrap

For non-UI text, text will wrap after it goes past this point. Wrapping is disabled if this is set to 0.

uiWrap

bool SuperTextMesh.uiWrap

For UI text, if this is true, text will wrap at the rectTransform bounds.

breakText

bool SuperTextMesh.breakText

If true, instead of text trying to always insert automatic line breaks at previous spaces, tabs, and hyphens, text will just drop down a row a the very end of a row.

insertHyphens

bool SuperTextMesh.insertHyphens

If true, when text exceeds the bounds, and there isn't a previous space to insert a line break, a hyphen will be inserted, and the word will be split.

verticalLimit

int SuperTextMesh.verticalLimit

For non-UI text, When greater than 0, this sets the vertical bounding box. Text beyond this limit will behave differently depending on the current vertical limit mode.

uiLimit

bool SuperTextMesh.uiLimit

For UI text, if this is true, text will be limited by the rectTransform bounds.

verticalLimitMode

SuperTextMesh.verticalLimitMode

Controls how text is treated if it exceeds the vertical limit.

Text will scroll to show the last lines of text in the box. This is good for textboxes like the ones in most RPGs with small text boxes.

Text will be cut off at the limit, and all extra text will end up, with proper tags, in a variable named "leftoverText".

Text will ignore the limit. You can use this if you want to use the vertical limit to position a box, but not restrict it for whatever reason.

A combination of cutoff and showlast. When text reaches the vertical limit, it will be cut off until Continue() is called. After calling continue, this will repeat until the vertical limit is met again.

Like auto pause, but when Continue() is called, the text box starts reading the new text from the top of the box, instead of using the show last effect. This value is based on verticalLimit, so it's suggested to use a vertical limit that is a multiple, or close to a multiple of size.

Note: Text Bounds for Show Last, Auto Pause, and Auto Pause Full might appear incorrectly for text that changes size mid-string.

lineHeights

[READ ONLY] List SuperTextMesh.lineHeights

A list containing the heights of each line. The Count property of this is the amount of lines the STM object has, and the floats are the height of each line. Can beused for things like the LinkController class!

Timing

ignoreTimeScale

bool SuperTextMesh.ignoreTimeScale

If set to true, this text mesh will not be effected by time scale in any way.

disableAnimatedText

bool SuperTextMesh.disableAnimatedText

Disable all animated effects for this text mesh. A master toggle for all text meshes can be found in [Text Data](#Text Data Customization).

forceAnimation

bool SuperTextMesh.forceAnimation

If true, Super Text Mesh will update every frame, even if there isn't an animation to play. This is intended to be used if you're animating an STM parameter (such as color) through an Animator.

autoRead

bool SuperTextMesh.autoRead

Tell text to read out by itself or not when Rebuild() is called. Text can be told to read manually with Read().

rememberReadPosition

bool SuperTextMesh.rememberReadPosition

When the mesh is enabled/disabled, this controls whether the mesh will remember where it was while drawing, or follow its legacy behaviour and act as if Rebuild() was called. Rebuild() can be called when re-enabling text while this boolean is true, too.

readDelay

float SuperTextMesh.readDelay

The delay between letters when text is being read out. Reading disabled if set to 0.

drawOrder

SuperTextMesh.DrawOrder drawOrder

What order the text will draw in.

drawAnimName

string SuperTextMesh.drawAnimName

The name of the draw animation that will be used for this mesh. Can be defined in [TextData](#Text Data). Case-sensitive.

Functionality

speedReadScale

float SuperTextMesh.speedReadScale

Multiple of timeScale for when SpeedRead() is active.

unreadDelay

float SuperTextMesh.unreadDelay

The delay between letters for when text is unreading.

undrawOrder

SuperTextMesh.DrawOrder undrawOrder

What order the text will undraw in. Same options as drawOrder.

undrawAnimName

string SuperTextMesh.undrawAnimName

The name of the draw animation that will be used for undrawing on this mesh. Can be defined in TextData. Case-sensitive.

Audio

audioSource

AudioSource SuperTextMesh.audioSource

The audio source to be used by this text mesh. Must be defined to use audio.

audioClips

AudioClip[] SuperTextMesh.audioClips

Audio clips to be used while reading out text. Only a single clip is needed, but if there's multiple, a random sound clip will be chosen from the array.

stopPreviousSound

bool SuperTextMesh.stopPreviousSound

If set to true, whenever a new letter is read, it'll play a new sound and stop the old one. If set to false, new letters will not override old ones, it'll wait for the clip to end before playing a new sound.

pitchMode

SuperTextMesh.pitchMode

When reading out text, how the pitch of the sounds will be effected.

overridePitch

float SuperTextMesh.overridePitch [Range(0f,3f)]

If the pitchMode is set to "Single", this will be the new pitch used.

minPitch

float SuperTextMesh.minPitch [Range(0f,3f)]

If the pitchMode is set to "Random" or "Perlin", this will be the minimum random pitch.

maxPitch

float SuperTextMesh.maxPitch [Range(0f,3f)]

If the pitchMode is set to "Random" or "Perlin", this will be the maximum random pitch.

perlinPitchMulti

float SuperTextMesh.perlinPitchMulti

If the pitchMode is set to "Perlin", this will control how quickly the perlin noise value changes.

speedReadPitch

float SuperTextMesh.speedReadPitch

When speedReading, this value will be ADDED to the pitch.

Looking for even more advanced audio control? STM's PlaySound() method is virtual, and STM can be extended to work with other audio engines! You can also use OnPrintEvent, which gets invoked at the exact same time as PlaySound().

Bounds Variables

Raw Bounds

rawTopLeftBounds

[READ ONLY] Vector3 SuperTextMesh.rawTopLeftBounds

The top-left bounds of the mesh, local to the mesh and uneffected by transform.

rawBottomRightBounds

[READ ONLY] Vector3 SuperTextMesh.rawBottomRightBounds

The bottom-right bounds of the mesh, local to the mesh and uneffected by transform.

rawBottomRightTextBounds

[READ ONLY] Vector3 SuperTextMesh.rawBottomRightTextBounds

The the with and height of text is stored here, unclamped by bounds.

Defined Bounds

topLeftBounds

[READ ONLY] Vector3 SuperTextMesh.topLeftBounds

The top-left bounds of the mesh, in world space.

topRightBounds

[READ ONLY] Vector3 SuperTextMesh.topRightBounds

The top-right bounds of the mesh, in world space.

bottomLeftBounds

[READ ONLY] Vector3 SuperTextMesh.bottomLeftBounds

The bottom-left bounds of the mesh, in world space.

bottomRightBounds

[READ ONLY] Vector3 SuperTextMesh.bottomRightBounds

The bottom-right bounds of the mesh, in world space.

centerBounds

[READ ONLY] Vector3 SuperTextMesh.centerBounds

The center of the bounds of the mesh, in world space.

Text Bounds

topLeftTextBounds

[READ ONLY] Vector3 SuperTextMesh.topLeftTextBounds

The top-left corner of the mesh's text bounds, in world space. This value changes as a mesh reads out.

topRightTextBounds

[READ ONLY] Vector3 SuperTextMesh.topRightTextBounds

The top-right corner of the mesh's text bounds, in world space. This value changes as a mesh reads out.

bottomLeftTextBounds

[READ ONLY] Vector3 SuperTextMesh.bottomLeftTextBounds

The bottom-left corner of the mesh's text bounds, in world space. This value changes as a mesh reads out.

bottomRightTextBounds

[READ ONLY] Vector3 SuperTextMesh.bottomRightTextBounds

The bottom-right corner of the mesh's text bounds, in world space. This value changes as a mesh reads out.

centerTextBounds

[READ ONLY] Vector3 SuperTextMesh.centerTextBounds

The center of the text bounds of the mesh, in world space. This value changes as a mesh reads out.

Final Text Bounds

finalTopLeftTextBounds

[READ ONLY] Vector3 SuperTextMesh.finalTopLeftTextBounds

The top-left corner of the mesh's text bounds after it has finished reading out, in world space.

finalTopRightTextBounds

[READ ONLY] Vector3 SuperTextMesh.finalTopRightTextBounds

The top-right corner of the mesh's text bounds after it has finished reading out, in world space.

finalBottomLeftTextBounds

[READ ONLY] Vector3 SuperTextMesh.finalBottomLeftTextBounds

The bottom-left corner of the mesh's text bounds after it has finished reading out, in world space.

finalBottomRightTextBounds

[READ ONLY] Vector3 SuperTextMesh.finalBottomRightTextBounds

The bottom-right corner of the mesh's text bounds after it has finished reading out, in world space.

finalCenterTextBounds

[READ ONLY] Vector3 SuperTextMesh.finalCenterTextBounds

The center of the text bounds of the mesh after it has finished reading out, in world space.

Unwrapped Bounds

unwrappedMaxX

[READ ONLY] float SuperTextMesh.unwrappedMaxX

Width of rendered text, ignoring autoWrap.

unwrappedMinY

[READ ONLY] float SuperTextMesh.unwrappedMinY

Height of rendered text, ignoring autoWrap & vertical limit.

Extra Stuff

debugMode

[EDITOR ONLY] bool SuperTextMesh.debugMode

If true, in the Unity editor, the Mesh Renderer and Mesh Filter components will become visible, along with any materials.

latestNumber

[READ ONLY] int SuperTextMesh.latestNumber

As the mesh is reading out, this will be the index of the last number read this frame. You can use SuperTextMesh.hyphenedText[latestNumber] to get the latest character drawn on any frame.

currentReadTime

[READ ONLY] float SuperTextMesh.currentReadTime

As the mesh reads out, this is the time elapsed reading. Use Rebuild(currentReadTime) to have a mesh rebuild from its current position!

totalReadTime

[READ ONLY] float SuperTextMesh.totalReadTime

The total amount of time it will take the mesh to read out text, including animations.

totalUnreadTime

[READ ONLY] float SuperTextMesh.totalUnreadTime

The total amount of time it will take the mesh to unread text, including animations.

leftoverText

[READ ONLY] string SuperTextMesh.leftoverText

If text is given a vertical limit and set to "Cut Off", "Auto Pause", or "Auto Pause Full" mode, all text that gets cut off will end up here as unformatted text, ready to be sent to another Super Text Mesh object. To avoid spaces at the start, you can set the text to be leftoverText.TrimStart().

linebreakFriendlyChars

[PRIVATE] char[] SuperTextMesh.linebreakFriendlyChars

An array of characters that a linebreak/hyphen will prefer to appear at when breaking up text at the autoWrap limit. By default, these characters are... Space, Tab, Linebreak, Hyphen, Soft Hyphen, Hair Space, and Zero Width Space.

canContinue

[READ ONLY] bool SuperTextMesh.canContinue

Returns true if Continue() will make Super Text Mesh read more text. It isn't really needed, since calling Continue() will return true if text has continued.

canUndoContinue

[READ ONLY] bool SuperTextMesh.canUndoContinue

Same as canContinue, but for UndoContinue().

pauseCount

[READ ONLY] int SuperTextMesh.pauseCount

Total amount of pauses Super Text Mesh will have before reaching the end of the string, both automatic and manual.

currentPauseCount

[READ ONLY] int SuperTextMesh.currentPauseCount

Total times Continue() has been called, essentially.

UnityEvents & Delegate Events



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 Print Event ()

Invoked when a new letter is printed by STM. Can be used to tell a textbox to resize, among other uses.

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, STMTextInfo)

Invoked with the event tag (<e=myString> / <e2=myString>). Passes an argument that has a string, and the STMTextInfo attached to the letter. The "e" tag makes an event happen for one character, and the "e2" tag repeats that event for every character until cancelled with "</e2>". The string is the "tag" written with the event. ("myString", in this case) STMTextInfo 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 STMTextInfo 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. Included samples show things like using STM as links and buttons, and spawning particle effects on certain letters. Check it out!

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)

Pre Parse (STMTextContainer)

Another non-typical event like the vertex mod. Pre-parsing can be used to manually parse text before it reaches SuperTextMesh's internal parser. This can be used for things such as...

public string addToStart = "";

public void Parse(STMTextContainer x)

{

 x.text = addToStart + x.text;

}

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

These events all have matching Delegate Events that are invoked at the same time. If you prefer to use delegate events, the names you can subscribe to are "OnPrintEvent", "OnRebuildEvent", "OnCompleteEvent", "OnUndrawnEvent", "OnCustomEvent", "OnVertexMod", and "OnPreParse". (Note the uppercase letters)


Shaders & Shadows

Changing Shaders & Included Shaders

You can drag a new shader onto the "text shader" area to change that. The included shaders all start with the prefix "STM" for easy searching.

As of v1.8.2, all these shaders have uber shader features! Each one has a culling mode toggle (Cull Back, Cull Front, Cull Off), An option to Render On Top (Set automatically for UI shaders), a Pixel Snap toggle, a toggle to render [SDF fonts](#SDF Fonts) properly, and for UI shaders, masking options!

Enabling Shadowcasting

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

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!

SDF Fonts

To use "SDF Mode" on a shader properly, 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!

NOTE: You can also use SDF mode on normal fonts! They'll render sharp, but not as precisely as converted fonts when observed close-up. Give it a try!


Utilities

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.

Change Sorting Order

In the Utility folder, there's a script names "STMChangeSortingOrder". Add the component to any object with a Super Text Mesh component on it, and you'll be able to change the sprite sorting order and the sprite sorting layer. It also works with any gameobject with a renderer.

Additional Helper Scripts

I sometimes upload other scripts that haven't made the final cut to STM just yet to my Pastebin! Look for the scripts that begin with "STM".

Support Packages for Other Assets

Fleece support!

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. Compatibility is not guaranteed for these packages, and they might have to be updated for compatibility with newer versions of the connected assets.

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

Here's an additional page where I keep track of this information!


FAQ

What fonts are supported?

.OTF and .TTF fonts are supported, as well as any font that uses Unity's Custom Font Class. SDF fonts are also supported, but must be converted first. To see if your font is supported before purchasing, see if it works with Unity's built-in text mesh!

What languages are supported?

This is actually the same as the above question! If your font has characters for the language you want, check to see if it works with Unity's built-in text mesh! Super Text Mesh will default back to Unity's default font, Arial, where most languages are supported if your font doesn't contain the appropriate characters.

How can I credit you in my game?

First of all, thanks! Here's how you can credit me:

ASSETS USED / TEXT PROGRAMMING & FX

Super Text Mesh by Kai Clavier

Or if you don't want to mention used assets:

ADDITIONAL PROGRAMMING

Text Programming & FX by Kai Clavier (kaiclavier.com)

Something along these lines should do it!

Should I buy Super Text Mesh on itch.io or the unity asset store?

Here's the pros of buying on each storefront:

Unity Asset Store

itch

I changed the material settings on one text mesh and others changed too! Help!

A Text Mesh's "Text Material" field represents a material that can be shared between multiple meshes. This is useful for situations like having a bunch of UI elements that you want to use the same outline settings, and then when you want to change the outline width, you'll only have to edit the material, not select every element. If you want your mesh to have a new material, you can create a new material with the "New" button right in the inspector!

How do I get the latest character drawn by Super Text Mesh?

Use superTextMesh.hyphenedText[superTextMesh.latestNumber]!

Text is just rendering the outline!

Is your project using URP/HDRP? The outline and dropshadow shaders currently rely on multiple passes to work, and this doesn't render with URP/HDRP... in-editor. If you build your game, text seems to render as expected. I'm planning to get outlines and dropshadows working naturally with URP/HDRP in the future, but for now... Here's a script I wrote that can emulate the outline effect STM does, if you attach it to an STM object.

Text is rendering just plain weird when I change the font or use a quad!!

Are you using Unity 2021? It's an experimental version of Unity, and it seems that mesh renderers with multiple materials on them render strangely with it. Text will use multiple materials if you change the font or use a quad, so if you were to avoid those effects it should work. Otherwise, all I can reccommend is avoiding Unity 2021 for the time being.

Notes

Known Bugs

Planned Features / To Do List:


ChangeLog

v1.0
v1.1
v1.1.1
v1.2:
v1.2.1
v1.2.2
v1.3
v1.3.1
v1.4
v1.4.1
v1.4.2
v1.4.3
v1.4.4
v1.4.5
v1.4.6
v1.4.7
v1.4.8
v1.4.9
v1.4.10
v1.4.11
v1.4.12
v1.4.13
v1.5
v1.5.1
v1.5.2
v1.6
v1.6.1
v1.6.2
v1.6.3
v1.7
v1.7.1
v1.8
v1.8.1
v1.8.2
v1.8.3
v1.8.4
v1.8.5
v1.8.6
v1.8.7
v1.8.8
v1.8.9
v1.8.10
v1.8.11
v1.8.12
v1.8.13
v1.8.14
v1.8.15
v1.8.16
v1.8.17
v1.8.18
v1.9
v1.9.1
v1.9.2
v1.10.0
v1.10.1
v1.10.2
v1.10.3
v1.11
v1.11.1
v1.11.2
v1.11.3
v1.11.4
v1.11.5
v1.12.0
v1.12.1
v1.12.2
v1.12.3
v1.12.4
v1.13.0

Update Warnings

v1.3 to v1.4+:
v1.4 to v1.5+:
v1.5 to v1.6+:
v1.6 to v1.7+:
v1.7 to v1.8+
v1.8 to v1.9+
v1.9 to v1.10+
v1.10 to v1.11

Credits

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