Skip to main content

TextFont

A class in Root.Township, the global namespace.

Asset holding the letter meshes for 3D mesh text (used by TextRenderer). Letters are looked up by character code.

Constructors​

MemberWhat it is
TextFont()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

MemberWhat it is
const int MaxCharactersSize of the lookup table (256). Only character codes below this are supported.
const float WidthScalarConstant 0.005, probably the scale from font units to world width.
4 private and internal fields
MemberWhat it is
private static Dictionary<TextFont, LetterMesh[]> fontsStatic cache of lookup tables, one per font asset.
private Font linkedFontBacking field for LinkedFont.
private LetterMesh spaceLetter mesh used for the space character.
private TextFont.TextFontLOD[] textFontLODsLetter mesh sets per level of detail. Only the first one is used.

Properties​

MemberWhat it is
Font LinkedFont { get; }The Unity font this mesh font was made from.

Methods​

MemberWhat it is
LetterMesh GetLetterMesh(char character)Returns the letter mesh for a character, or null for codes 256 and above. Builds and caches the lookup table on first use.
1 private and internal method
MemberWhat it is
private void OnValidate()Editor: clears the cached lookup table so changes show up.

Used in​

Members of other types that take, return or hold a TextFont: