Text.MakeStyle

static TextStyle MakeStyle(Font font, float characterHeight, Material material, Color32 color)

   
Font font Font asset you want attached to this style.
float characterHeight Height of a text glpyh in meters. TODO: find what text glyph specifically!
Material material Which material should be used to render the text with?
Color32 color The color of the text style. This will be embedded in the vertex color of the text mesh.
RETURNS: TextStyle A text style id for use with text rendering functions.

Create a text style for use with other text functions! A text style is a font plus size/color/material parameters, and are used to keep text looking more consistent through the application by encouraging devs to re-use styles throughout the project.

Examples

Drawing text with and without a TextStyle

Basic text We can use a TextStyle object to control how text gets displayed!

TextStyle style;

In initialization, we can create the style from a font, a size, a material, and a base color.

style = Text.MakeStyle(
    Font.FromFile("C:/Windows/Fonts/Arial.ttf"), 
    2 * U.cm,
lt.MaterialFont.Copy(), 
    Color.HSV(0.05f, 0.7f, 0.8f));

Then it’s pretty trivial to just draw some text on the screen! Just call Text.Add on update. If you don’t have a TextStyle available, calling it without one will just fall back on the default style.

// Text with an explicit text style
Text.Add(
    "Here's\nSome\nMulti-line\nText!!", 
    Matrix.TRS(new Vec3(0.1f, 0, 0), Quat.LookDir(0, 0, 1)),
    style);
// Text using the default text style
Text.Add(
    "Here's\nSome\nMulti-line\nText!!", 
    Matrix.TRS(new Vec3(-0.1f, 0, 0), Quat.LookDir(0, 0, 1)));