Class CompositeNavPathRewriter
The composite-child transition-path rewrite algorithm, extracted out of
UnityCompositeViewDefinitionEditor so the CustomEditor
only drives the "what changed" detection while this class owns the "::"-path segment algebra. Lives
beside CompositeNavWiring (which already centralizes the same separator/path conventions
for the builder) rather than in Business/Ui: RewriteMenuTransitionSegment(string, string, string) is inherently
editor tooling (it walks and mutates UnityEditor.SerializedObjects across the project via
UnityEditor.AssetDatabase), so the class as a whole cannot be engine-agnostic even though its innermost
helper, RewriteChildSegment(string, string, string, string), is pure string logic. Splitting just that one pure method into
Business would separate the rule from the only code that exercises it, without giving any other consumer
(runtime only walks paths via UnityMenuView.Actions; nothing else rewrites them) a reason to depend
on it — so this stays extract-only, editor-side.
Inherited Members
Namespace: Serenity.Ui.Infrastructure.Editor.Builder
Assembly: Serenity.UnityUi.Infrastructure.Editor.dll
Syntax
public static class CompositeNavPathRewriter
Methods
RewriteChildSegment(string, string, string, string)
Returns value with each consecutive "compositeId::oldChildId" segment pair
rewritten so the child becomes newChildId; returns null when the value contains
no such pair (so callers can skip it).
Declaration
public static string RewriteChildSegment(string value, string compositeId, string oldChildId, string newChildId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The transition value to inspect. |
| string | compositeId | The parent composite id to match. |
| string | oldChildId | The child id to match (immediately after the composite). |
| string | newChildId | The replacement child id. |
Returns
| Type | Description |
|---|---|
| string | The rewritten value, or null when unchanged. |
RewriteMenuTransitionSegment(string, string, string)
Across all menu definition assets, rewrites every MENU_TRANSITION value whose transition path
contains the consecutive segment pair "compositeId::oldChildId",
replacing that child segment with newChildId. This keeps both direct
("composite::child") and full-path ("root::...::composite::child") targets in sync. Done over
UnityEditor.SerializedObject (found by type name) so this editor needs no dependency on the menu
module; changes register Undo and dirty the assets.
Declaration
public static void RewriteMenuTransitionSegment(string compositeId, string oldChildId, string newChildId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | compositeId | The composite whose child slot changed. |
| string | oldChildId | The previous child id. |
| string | newChildId | The new child id. |
SyncNavTransitionsForChangedChildren(string, List<string>, List<string>)
When a child slot's hosted view was REPLACED (its id changed and the old id no longer appears
anywhere in the composite), rewrites every menu's matching transition target
"compositeId::oldChildId" to "compositeId::newChildId" so nav options follow the swap.
Skips slot reorders (old id still present) and slot add/remove (different child count), which are
ambiguous to auto-rewrite.
Declaration
public static void SyncNavTransitionsForChangedChildren(string compositeId, List<string> oldIds, List<string> newIds)
Parameters
| Type | Name | Description |
|---|---|---|
| string | compositeId | The id of the edited composite. |
| List<string> | oldIds | Child ids before the edit. |
| List<string> | newIds | Child ids after the edit. |