Class FontAssetCreator
Turns a source UnityEngine.Font into a persisted, Addressable TMPro.TMP_FontAsset — the
atomic counterpart to the Theme Builder's Font step. The HUD Builder's inline "Generate" button routes
through this engine; the Theme Builder keeps calling SerenityFontAssetGenerator directly
because its font is one asset inside the theme's own transaction, which registers and rolls back the
whole theme at once. Mirrors GameSaveCreator: static class, Input/Result DTOs,
ValidateIdentity/Validate/Create, Serenity.Global.Infrastructure.Editor.SerenityAssetCreationTransaction for rollback. Every
mutation lives here; SerenityFontAssetGenerator stays the single owner of TMPro's
mandatory parent-then-sub-asset write order.
Never overwrites an existing target: a same-name run only warns, and SerenityFontAssetGenerator
uniquifies the path. A generated TMPro.TMP_FontAsset carries no Serenity-owned authoring state
to draft and re-commit, and every prefab already referencing it would break on a silent replace, so the
"tools are management tools" update-in-place shape does not apply here.
Inheritance
FontAssetCreator
Assembly: Serenity.UnityUi.Infrastructure.Editor.dll
Syntax
public static class FontAssetCreator
Fields
DefaultAssetName
Fallback asset name used when neither AssetName nor
SourceFont's own name sanitizes to something non-empty.
Declaration
public const string DefaultAssetName = "Font"
Field Value
DefaultOutputFolder
Folder a font asset is created under when the caller names none.
Declaration
public const string DefaultOutputFolder = "Assets/Game/Media/Fonts"
Field Value
Methods
The project path Create(Input) will write to for input's current
name and folder, before SerenityFontAssetGenerator's own uniquification — the single
place that path is assembled, so a caller previewing it (a wizard's Summary step) never re-derives
the suffix/extension pairing by hand.
Declaration
public static string BuildPlannedAssetPath(FontAssetCreator.Input input)
Parameters
Returns
Validates the request, then generates the font asset inside a transaction. On any failure every
mutation is rolled back so the project is left untouched.
Declaration
public static FontAssetCreator.Result Create(FontAssetCreator.Input input)
Parameters
Returns
Full validation, re-checked at creation time so Create(Input) is safe to call
independently of a window's live validation.
Declaration
public static SerenityCreationValidationResult Validate(FontAssetCreator.Input input)
Parameters
Returns
| Type |
Description |
| SerenityCreationValidationResult |
|
Source-font-and-name-only validation, usable before an output folder has been chosen.
Declaration
public static SerenityCreationValidationResult ValidateIdentity(FontAssetCreator.Input input)
Parameters
Returns
| Type |
Description |
| SerenityCreationValidationResult |
|