Class CreateHudWindow
Creates a new HUD or edits an existing one: elements, their placement, what each reads and how it is drawn.
Namespace: Serenity.GameUi.Infrastructure.Editor.Builder
Assembly: Serenity.UnityGameUi.Infrastructure.Editor.dll
Syntax
public sealed class CreateHudWindow : SerenityStepWizardWindow<CreateHudWindow.WizardStep>
Remarks
Collects input and renders results only; HudCreator does every asset mutation. Editing happens on a scratch instance so nothing is written to disk until the button is pressed, the same trick the modal and feedback builders use to reuse the real inspector GUI inside a wizard.
Built as a stepped wizard on Serenity.Global.Infrastructure.Editor.SerenityWizardGui like every other Serenity builder, with the elements shown one at a time beside a list of them. A HUD is a set of near-identical entries of about twenty fields each; laid out end to end they read as a wall, and the wall grows with the project.
The stepped-wizard scaffolding — the header and breadcrumb, the body scroll, the footer and its error gate — comes from Serenity.Global.Infrastructure.Editor.SerenityStepWizardWindow`1; this window declares only its own step table, the preview controls it draws under the breadcrumb, the status line it draws under the footer, and what the primary action does.
Constructors
CreateHudWindow()
Declaration
public CreateHudWindow()
Properties
PrimaryButtonLabel
Re-read every repaint: "Update HUD" once a HUD asset is loaded, "Create HUD" otherwise.
Declaration
protected override string PrimaryButtonLabel { get; }
Property Value
| Type | Description |
|---|---|
| string |
WindowTitle
Declaration
protected override string WindowTitle { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
BuildSteps()
Declaration
protected override WizardStepDescriptor<CreateHudWindow.WizardStep>[] BuildSteps()
Returns
| Type | Description |
|---|---|
| WizardStepDescriptor<WizardStep>[] |
DrawBelowFooter()
The status line the old OnGUI drew under the footer, and the scratch write-back that
closed the frame — the base's own activity log draws after this and is empty on this window, so the
write-back is still the last thing the frame does.
Declaration
protected override void DrawBelowFooter()
DrawUnderBreadcrumb()
The Preview controls belong under the breadcrumb and outside the body scroll, so they stay reachable from every step rather than scrolling away with the step they were drawn in.
Declaration
protected override void DrawUnderBreadcrumb()
OnBeforeDrawStep()
Re-reads the scratch instance and takes this frame's validation snapshot — both before
anything reads a step error, which is the ordering the old OnGUI got by doing them above its
own header drawing.
Declaration
protected override void OnBeforeDrawStep()
OnPrimaryAction()
Lands on Done through the base's GATED Serenity.Global.Infrastructure.Editor.SerenityStepWizardWindow`1.GoTo(`0), not Serenity.Global.Infrastructure.Editor.SerenityStepWizardWindow`1.PingAndGoTo(System.String,`0,System.Boolean): this window never pinged what it wrote — the Done panel's own button does that — and its hand-rolled jump already ran through the step-error gate this window installed for itself.
Declaration
protected override void OnPrimaryAction()
ShowForAsset(string, string, string)
Opens the builder on the HUD at a project path, focused on one element.
Declaration
public static void ShowForAsset(string assetPath, string elementId, string section)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetPath | Project path of the HUD asset. |
| string | elementId | Id of the element to select; empty selects the first. |
| string | section | Section name to open, from HudDefinitionScanner.Sections. |
Remarks
Takes a path rather than the asset so a caller outside this aggregate — the project-wide validator report, which knows only what a finding carries — does not have to reference the GameUi runtime assembly just to name a type it never otherwise touches.
ShowForExisting(UnityHudDefinition)
Opens the builder already editing an existing HUD.
Declaration
public static void ShowForExisting(UnityHudDefinition hud)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityHudDefinition | hud | The HUD to load. |
ShowForExisting(UnityHudDefinition, string, string)
Opens the builder on an existing HUD with one element already selected and the group of fields at fault already showing.
Declaration
public static void ShowForExisting(UnityHudDefinition hud, string elementId, string section)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityHudDefinition | hud | The HUD to load. |
| string | elementId | Id of the element to select; empty selects the first. |
| string | section | Section name to open, from HudDefinitionScanner.Sections. |
Remarks
This is what turns a finding in a project-wide report into a link: the report knows which element and which section, and those are exactly the two coordinates this window navigates by.
ShowWindow()
Declaration
public static void ShowWindow()