Text
Draws a line (or lines) of text at the entity. Scripts set Value.
Needed by: NameTag, Scoreboard, TextField, Typewriter
Draws itself (its entity draws at Order 0 unless it has a Sprite, whose order counts).
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
value: text = “Text”. What it says. Several lines are fine. (While output names an output, how it reads: {0} is the output and {1} what it’s out of, each with a number format after a colon if it says, e.g. “Gold: {0}”, “{0} / {1}” or “{0:0.0} m/s”; without them it shows just the output.) (Field: its own editor: Output Format.)size: a number = 1. Height of one line in world units, before the transform’s scale. (Field: a number.)color: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFFFFFFF”. The color of the letters. (Field: a color.)order: a whole number = 0. Higher draws on top, like Sprite.Order. (Field: a number.)font: text = null. 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). (Names a font.) (Field: a name.)align: one of Center, Left, Right = “Center”. Where the text sits relative to the entity; lines of several-line text line up the same way. (Field: one of its values.)verticalAlign: one of Middle, Top, Bottom = “Middle”. 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. (Field: one of its values.)wrapWidth: a number = 0. 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. (Field: a number.)
Background
Section titled “Background”background: a color, “#RRGGBB” or “#RRGGBBAA” = “#00000000”. 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. (Field: a color.)padding: a number = 0. With a Background: how far the box reaches past the text on every side, in world units before the transform’s scale (like Size). (Only used when background is set.) (Field: a number.)
Showing an Output
Section titled “Showing an Output”track: text = null. 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. (Names an entity.) (Field: an entity’s name.)output: text = null. 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. (Names an output of the entity track names, or without one this entity or the nearest it’s inside with it: one component_describe lists under Outputs, any kind, e.g. “Score”, “MatchBoard.Score” for one component’s, or “Amount:Gold” for one read by a name.) (Field: an output’s name.)countTime: a number = 0. 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. (Only used when output is set.) (Field: a number.)
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
shown: text. 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.
Scripts use it as Text: its methods, events and values that aren’t saved with the scene.