Class HudElementListGui
Draws the list of HUD elements: placement, caption, bindings, representation and update policy.
Inherited Members
Namespace: Serenity.GameUi.Infrastructure.Editor.Builder
Assembly: Serenity.UnityGameUi.Infrastructure.Editor.dll
Syntax
public static class HudElementListGui
Remarks
Shared by the builder window and the HUD asset's own inspector, so a HUD is edited the same way whether
it is being created or corrected later. Follows FeedbackEffectListGUI's approach to the
polymorphic representation, but discovers the subtypes through UnityEditor.TypeCache instead of a
hand-written menu, so a new representation shows up without editing this file.
Methods
AddElement(SerializedProperty)
Appends a blank root element.
Declaration
public static void AddElement(SerializedProperty elements)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | elements | The serialized element list to append to. |
AddElement(SerializedProperty, string)
Appends a blank element, parented under parentId when given — what a box row's
"+" action uses to add a child directly.
Declaration
public static void AddElement(SerializedProperty elements, string parentId)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | elements | The serialized element list to append to. |
| string | parentId | Id of the FLEXBOX box to nest the new element under, or empty for a root element. |
Remarks
Growing a serialized array copies the previous entry, so every field has to be reset explicitly. Without this, "Add element" silently produces a duplicate of the last one — same anchor, same bindings, same caption — which is never what is wanted and is easy to miss until two elements are drawing on top of each other.
BadgesFor(SerializedProperty, ParentStatus)
Where it sits, how it draws, what it reads — the three questions asked while scanning.
Declaration
public static SerenityListRowGui.Badge[] BadgesFor(SerializedProperty element, HudElementTreeOrder.ParentStatus parentStatus)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | element | The serialized |
| HudElementTreeOrder.ParentStatus | parentStatus | The SAME HudElementTreeOrder.ParentStatus that decided this row's place in the tree (from its HudElementTreeOrder.Row), not a separate re-check — a badge computed from its own independent lookup could disagree with the actual nesting the row shows, which is exactly the bug this parameter exists to rule out. |
Returns
| Type | Description |
|---|---|
| Badge[] | The badges shown beside a collapsed row's title. |
Draw(SerializedProperty)
Draws the whole element list with its add and remove controls, nested tree-style: each FLEXBOX box's children indented directly beneath it, via SolveFrom(SerializedProperty).
Declaration
public static void Draw(SerializedProperty elements)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | elements | The serialized list of |
DuplicateElement(SerializedProperty, int)
Duplicates an element, which is the normal way a second one gets made: most HUDs hold near-identical readouts that differ only in what they bind to. A box duplicates its whole subtree along with it, so a copied container arrives with its own copied contents. Every copy is given a fresh id so it is not silently reported as a duplicate by the validator.
Declaration
public static int DuplicateElement(SerializedProperty elements, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | elements | The serialized element list. |
| int | index | Position of the element to copy. |
Returns
| Type | Description |
|---|---|
| int | The array index the duplicated element ends up at. |
RemoveElement(SerializedProperty, int)
Removes an element; a box holding children asks whether to move them to the root or remove them too.
Declaration
public static bool RemoveElement(SerializedProperty elements, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | elements | The serialized element list. |
| int | index | Position of the element to remove. |
Returns
| Type | Description |
|---|---|
| bool | Whether anything was actually removed — false when the author cancelled the dialog. |