Skip to content

Text

namespace Griff.Scenes;
public sealed class Text : Component, IDrawable

Draws a line (or lines) of text at the entity. Scripts set Value.

This is a component: its saved properties are on its component page.

public TextAlign Align { get; set; }

Where the text sits relative to the entity; lines of several-line text line up the same way.

public Color Background { get; set; }

The color of a box drawn just behind the text, fitted to its lines as they’re drawn (as wide as the widest, as tall as all of them) with Padding round them, so a label stays readable over a busy floor and the box grows and shrinks with its words. It follows Align, VerticalAlign and WrapWidth, and is drawn at the text’s Order. Transparent (the default) draws none.

public Color Color { get; set; }

The color of the letters.

public float CountTime { get; set; }

Seconds a number its Output gives takes to count up or down to a new one, eased, rather than jumping there: a score adding up as points come in, gold draining as it’s spent. 0 jumps.

public string? Font { get; set; }

A font file relative to Assets (.ttf, .otf or .ttc, e.g. “Fonts/PressStart2P-Regular.ttf”), or the name of an installed font such as “Consolas”. Empty uses the built-in font (Selawik Semibold). The Inspector’s picker lists the fonts safe to ship (the built-in one, Griff’s free fonts, which picking copies into Assets/Fonts with their licenses, and the project’s font files) and, apart, those only installed on this PC: an installed font is never copied into the game, so it may be missing on players’ PCs and is never there in a browser (the built-in font draws instead, and exports warn of it).

public int Order { get; set; }

Higher draws on top, like Order.

public string? Output { get; set; }

Show an output while the game runs: what it gives now (see component_describe’s Outputs), e.g. a board’s “Score”, a turn order’s “Turn”, a beat clock’s “Beat”, a faction’s “Amount:Gold”. Value is then how it reads, with {0} for the output and {1} what it’s out of, e.g. “Gold: {0}”, “{0} / {1}” or “{0:0.0} m/s”; a Value without them shows just the output.

public float Padding { get; set; }

With a Background: how far the box reaches past the text on every side, in world units before the transform’s scale (like Size).

public string? Shown { get; }

What’s drawn: Value (with its Output filled in), with input prompts filled in while the game runs. An action’s name in braces becomes the key or button that does it on the device being played with, so “Press {Interact}” reads “Press E” on the keyboard and “Press Y” on a gamepad, and follows the player’s own bindings.

public float Size { get; set; }

Height of one line in world units, before the transform’s scale.

public string? Track { get; set; }

An entity whose Output it shows, by name, e.g. “Board”. Empty is this entity, or the nearest one it’s inside with that output.

public string? Value { get; set; }

What it says. Several lines are fine.

public TextVerticalAlign VerticalAlign { get; set; }

Where the lines sit up and down: centered on the entity (Middle), hanging from it with the first line’s top there (Top), or standing on it with the last line’s bottom there (Bottom), however many lines there are.

public float WrapWidth { get; set; }

Breaks lines between words so none is wider than this, in world units before the transform’s scale (like Size), going by the font’s own letters; a word wider than it has a line to itself. 0 breaks lines only where the text does.

public override string? LinkLabel(string property)