logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    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
    object
    FontAssetCreator
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Ui.Infrastructure.Editor.Builder
    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
    Type Description
    string

    DefaultOutputFolder

    Folder a font asset is created under when the caller names none.

    Declaration
    public const string DefaultOutputFolder = "Assets/Game/Media/Fonts"
    Field Value
    Type Description
    string

    Methods

    BuildPlannedAssetPath(Input)

    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
    Type Name Description
    FontAssetCreator.Input input
    Returns
    Type Description
    string

    Create(Input)

    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
    Type Name Description
    FontAssetCreator.Input input
    Returns
    Type Description
    FontAssetCreator.Result

    Validate(Input)

    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
    Type Name Description
    FontAssetCreator.Input input
    Returns
    Type Description
    SerenityCreationValidationResult

    ValidateIdentity(Input)

    Source-font-and-name-only validation, usable before an output folder has been chosen.

    Declaration
    public static SerenityCreationValidationResult ValidateIdentity(FontAssetCreator.Input input)
    Parameters
    Type Name Description
    FontAssetCreator.Input input
    Returns
    Type Description
    SerenityCreationValidationResult
    In this article
    © 2026 Serenity. All Rights Reserved