Class UiSettingsCreator
Generates (or updates) the project-wide UnityUiSettings asset from a single description.
Runs on SingletonSettingsCreationEngine<TSettings, TInput, TResult>: this class stays the
caller-facing static surface — Input/Result DTOs, ValidateIdentity/Validate/Create,
ResolveSettingsContext<TSettings>(string, string) for "edit existing" detection, the
EnsureSettings(string, bool, string) headless get-or-create seam — and forwards every member to one
UiSettingsCreator.Engine instance that supplies the module's own fields. Lives beside
CompositeViewGenerator — rather than beside CreateUiSettingsWindow in Ui
Installation's editor assembly — because Serenity.Ui.Infrastructure.Editor.Builder.CompositeViewGenerator.TrySetInitialView(System.String,Serenity.Ui.Infrastructure.Editor.Builder.CompositeViewGenerator.Result,System.String) needs it
too, and Ui Installation's editor assembly already depends on Ui Infrastructure's, so the reverse
direction would cycle; the window reaches this engine through that same existing dependency. Every asset
mutation lives in the engine; the window and the generator both only collect input/react to results.
UnityUiSettings's font size presets seed through the SO's own field initializer (small/medium/big), and its Prewarm labels/addresses are inspector-only fields with no meaningful value at creation time — neither UiSettingsCreator.Input nor Serenity.Ui.Infrastructure.Editor.Builder.UiSettingsCreator.Engine.ApplyFields(Serenity.Ui.Infrastructure.Editor.Builder.UiSettingsCreator.Input,Serenity.Ui.Installation.Settings.UnityUiSettings) touches either, so a freshly created asset keeps its three presets and an update never disturbs prewarm lists authored outside this wizard.
Inherited Members
Namespace: Serenity.Ui.Infrastructure.Editor.Builder
Assembly: Serenity.UnityUi.Infrastructure.Editor.dll
Syntax
public static class UiSettingsCreator
Fields
DefaultAssetName
Default asset file name for a brand-new settings asset.
Declaration
public const string DefaultAssetName = "UiSettings"
Field Value
| Type | Description |
|---|---|
| string |
DefaultFloatIncrement
These three defaults mirror the exact values on the package's own shipped reference asset,
Assets/Serenity/Media/Ui/UiSettings.asset. UiSettingsCreator.Input's field initializers and the
wizard window's serialized field initializers both reference these constants instead of repeating
the values, so a retune of the shipped asset only ever needs to change one place.
Declaration
public const float DefaultFloatIncrement = 0.01
Field Value
| Type | Description |
|---|---|
| float |
DefaultFontSizeKey
These three defaults mirror the exact values on the package's own shipped reference asset,
Assets/Serenity/Media/Ui/UiSettings.asset. UiSettingsCreator.Input's field initializers and the
wizard window's serialized field initializers both reference these constants instead of repeating
the values, so a retune of the shipped asset only ever needs to change one place.
Declaration
public const string DefaultFontSizeKey = "UI_HudFontSize"
Field Value
| Type | Description |
|---|---|
| string |
DefaultId
Default identifier written onto a brand-new settings asset when the caller names none.
Declaration
public const string DefaultId = "UiSettings"
Field Value
| Type | Description |
|---|---|
| string |
DefaultOutputFolder
Default output folder for a brand-new settings asset — under the game's content root,
matching every other singleton settings creator (SoundMixerSettingsCreator, GameSaveCreator).
Declaration
public const string DefaultOutputFolder = "Assets/Game/Media/Ui"
Field Value
| Type | Description |
|---|---|
| string |
DefaultScaleKey
These three defaults mirror the exact values on the package's own shipped reference asset,
Assets/Serenity/Media/Ui/UiSettings.asset. UiSettingsCreator.Input's field initializers and the
wizard window's serialized field initializers both reference these constants instead of repeating
the values, so a retune of the shipped asset only ever needs to change one place.
Declaration
public const string DefaultScaleKey = "UI_HudScale"
Field Value
| Type | Description |
|---|---|
| string |
Methods
Create(Input)
Validates the request, then either updates the existing asset named by Input.ExistingSettingsAssetPath or creates a brand-new one. On any failure during creation every mutation is rolled back so the project is left untouched; an update failure cannot occur past validation, since it only ever writes already-validated fields onto an asset already confirmed to exist.
Declaration
public static UiSettingsCreator.Result Create(UiSettingsCreator.Input input)
Parameters
| Type | Name | Description |
|---|---|---|
| UiSettingsCreator.Input | input |
Returns
| Type | Description |
|---|---|
| UiSettingsCreator.Result |
EnsureSettings(string, bool, string)
Headless get-or-create seam: resolves the project singleton, returning it untouched
(WasFoundExisting true) when found, creating one at folderPath
with UiSettingsCreator.Input's own defaults when none exists, or erroring with every path found when more
than one exists.
Declaration
public static UiSettingsCreator.Result EnsureSettings(string folderPath, bool registerAsAddressables, string searchRootFolder = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | folderPath | Folder a brand-new settings asset is created under, when none exists yet. |
| bool | registerAsAddressables | Whether a newly created asset is registered in the Addressables group. |
| string | searchRootFolder | Test seam: narrows the singleton scan to this folder instead of the
whole project, so a test creating its own UnityUiSettings fixtures under a temp
folder does not collide with the package's shipped singleton at
|
Returns
| Type | Description |
|---|---|
| UiSettingsCreator.Result |
ResolveSettingsContext(string, string)
Thin wrapper over the shared ResolveSettingsContext<TSettings>(string, string), exposed so the window can auto-detect the project-wide singleton for its "Edit existing" field, and so EnsureSettings(string, bool, string) can narrow the scan to a test fixture folder.
Declaration
public static SettingsAssetAuthoring.SettingsResolution<UnityUiSettings> ResolveSettingsContext(string explicitSettingsAssetPath = "", string searchRootFolder = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | explicitSettingsAssetPath | |
| string | searchRootFolder |
Returns
| Type | Description |
|---|---|
| SettingsResolution<UnityUiSettings> |
Validate(Input)
Full validation, re-checked at creation time so Create(Input) is safe to call independently of the window's live validation.
Declaration
public static SerenityCreationValidationResult Validate(UiSettingsCreator.Input input)
Parameters
| Type | Name | Description |
|---|---|---|
| UiSettingsCreator.Input | input |
Returns
| Type | Description |
|---|---|
| SerenityCreationValidationResult |
ValidateIdentity(Input)
Id-only validation, usable before a folder choice has been made.
Declaration
public static SerenityCreationValidationResult ValidateIdentity(UiSettingsCreator.Input input)
Parameters
| Type | Name | Description |
|---|---|---|
| UiSettingsCreator.Input | input |
Returns
| Type | Description |
|---|---|
| SerenityCreationValidationResult |