Making text - mariusz-tang/KTaNE-Module-Template GitHub Wiki
This page will guide you through adding text to your module.
Before you start, you should have a copy of your chosen font in your Assets folder. The font I will use for this demonstration is Kauchan Script, which you can get here.
Creating the text object
In Unity, add a 3D Object > 3D Text
. Set its Rotation
to 90, 0, 0, and set Anchor
and Alignment
in the TextMesh
as appropriate (usually Middle Center
and Center
, respectively, are fine). To increase the resolution of the text, increase the Font Size
(eg. to 500) and decrease the Character Size
(eg. to 0.001). Finally, set the Font
field to your chosen font file.
My text shows through the module!
Currently, the text will show through other objects, including the bomb.
To fix this, create a new material. If you would like the text to be visible when the lights are off (eg. on a display), set the Shader
to GUI > KT 3D Text
. Otherwise, set it to GUI > KT 3D Text Diffuse
. Then, drag your font's Font Texture
file into the Texture
field. Finally, set the 0th element of Materials
in your text object's MeshRenderer
to the new material.
Modifying the text via script
You can edit the text via a script by modifying the text
property of the TextMesh
component of your text object.
[SerializeField] private TextMesh _displayText;
private void ChangeText() {
_displayText.text = "new text!";
}