Class MenuCreator
Creates and updates menu assets, plus the project-wide menu service settings singleton they depend on.
All asset mutation for the Menu Manager wizard lives here; the window only collects input (through
MenuDraft) and renders results. Mirrors HudCreator: static class, Input/Result
DTOs, Validate then Create, one menu asset created or updated per MenuDraft in the batch.
Inherited Members
Namespace: Serenity.Menu.Infrastructure.Editor.Builder
Assembly: Serenity.UnityMenu.Infrastructure.Editor.dll
Syntax
public static class MenuCreator
Remarks
The service settings singleton is get-or-created: when MenuServiceSettingsCreator.Input.ExistingSettingsAssetPath is left empty, Serenity.Menu.Infrastructure.Editor.Builder.MenuCreator.ResolveEffectiveServiceSettingsInput(Serenity.Menu.Infrastructure.Editor.Builder.MenuServiceSettingsCreator.Input,System.Collections.Generic.List{System.String}@) resolves the project's own singleton (scoped to MenuServiceSettingsCreator.Input.OutputFolderPath, so a test's temp folder never collides with the package-shipped one elsewhere in the project) and updates it in place instead of failing with "an asset already exists". Everything — the settings singleton (created fresh via CreateNewWithin(Input, SerenityAssetCreationTransaction), or updated via UpdateExistingInPlace(Input)) and every menu draft — is written inside ONE Serenity.Global.Infrastructure.Editor.SerenityAssetCreationTransaction, so a failure anywhere in the run rolls back the settings singleton alongside the drafts rather than leaving it stranded on disk.
Fields
DefaultAssetNameFallback
Fallback file name for a draft whose id sanitizes to nothing.
Declaration
public const string DefaultAssetNameFallback = "NewMenu"
Field Value
| Type | Description |
|---|---|
| string |
DefaultOutputFolder
Default folder for generated menu assets.
Declaration
public const string DefaultOutputFolder = "Assets/Game/Media/Menu/Menus"
Field Value
| Type | Description |
|---|---|
| string |
InstallTaskMethodName
The UnitySerenityInstaller method the boot task must invoke for a menu's service to appear at
runtime. A menu asset in a project whose initialization pipeline never runs this method imports fine
and never resolves.
Declaration
public const string InstallTaskMethodName = "InstallMenu"
Field Value
| Type | Description |
|---|---|
| string |
OutputSection
Section name for a finding about the write target rather than a menu itself.
Declaration
public const string OutputSection = "Output"
Field Value
| Type | Description |
|---|---|
| string |
ServiceSettingsSection
Section name for a finding about the menu service settings singleton.
Declaration
public const string ServiceSettingsSection = "Service Settings"
Field Value
| Type | Description |
|---|---|
| string |
Methods
Create(Input)
Creates or updates the menu service settings and every menu draft in the input.
Declaration
public static MenuCreator.Result Create(MenuCreator.Input input)
Parameters
| Type | Name | Description |
|---|---|---|
| MenuCreator.Input | input | What to write. |
Returns
| Type | Description |
|---|---|
| MenuCreator.Result | The outcome, including every created and updated asset path. |
Validate(Input)
Checks the input without touching the project.
Declaration
public static SerenityCreationValidationResult Validate(MenuCreator.Input input)
Parameters
| Type | Name | Description |
|---|---|---|
| MenuCreator.Input | input | What the caller wants created. |
Returns
| Type | Description |
|---|---|
| SerenityCreationValidationResult | The errors and warnings found, across the service settings and every draft. |
ValidateWithDraftIssues(Input)
Same scan as Validate(Input), but also returns each draft's own findings alongside the
batch-wide result — see MenuValidationSnapshot. A window computes this ONCE per
OnGUI and hands each draft's own slice down to Serenity.Menu.Infrastructure.Editor.Builder.ViewNodeListGui and
Serenity.Menu.Infrastructure.Editor.Builder.MenuDraftDetailGui, rather than letting either re-scan the whole project a second
(or once-per-row) time via a per-draft Validate(Input)-shaped call of their own.
Declaration
public static MenuValidationSnapshot ValidateWithDraftIssues(MenuCreator.Input input)
Parameters
| Type | Name | Description |
|---|---|---|
| MenuCreator.Input | input | What the caller wants created. |
Returns
| Type | Description |
|---|---|
| MenuValidationSnapshot | The batch-wide result plus every draft's own findings, indexed like Drafts. |