Host and content routing¶
16 types in this area.
On this page
WaybranchMapHost · IMapNodeContentResolver · IMapNodeContentSelectionValidator · MapContentPoolAsset · MapContentPoolEntry · MapContentResolutionFailureKind · MapContentResolutionRequest · MapContentResolutionResult · MapContentRoutingDiagnosticCodes · MapContentSelection · MapHostDiagnosticCodes · MapHostFailureKind · MapHostOperationKind · MapHostOperationResult · MapHostSaveAdapterKind · MapHostSeedPolicy
WaybranchMapHost¶
:material-star: Start here
Waybranch.Runtime · Waybranch/Runtime/Runtime/WaybranchMapHost.cs
Designer-first scene host for one complete Waybranch run. It compiles authoring assets,
generates or restores the graph, binds presentation, owns deterministic content-routing
history, and persists the entire run through a selected IMapSaveAdapter.
Advanced callers can continue to use the compiler, generator, controller, and adapters
directly; the host is an orchestration layer rather than a replacement API.
Properties
public MapContentSelection ActiveSelection-
The current node's routed content, or null between nodes.
public MapBlueprintAsset Blueprint-
The blueprint compiled for new runs.
public IReadOnlyList<MapContentSelection> ContentHistory-
Committed routed selections in traversal order.
public MapStringUnityEvent ContentRequestedUnityEvent-
Inspector-safe content-ID counterpart to
ContentRequested. public MapDataPayload CustomerMetadata-
Customer-owned metadata restored from or most recently written to the save.
public Exception Exception-
What the generator threw, if anything; cancellation lands in
Resultinstead. public MapStringUnityEvent HostFailedUnityEvent-
Inspector-safe failure-message counterpart to
HostFailed. public MapUnityEvent HostReadyUnityEvent-
Inspector-safe counterpart to
HostReady. public bool IsFinished-
Whether the worker has stopped, however it stopped.
public bool IsReady-
Whether a traversal run is initialized.
public MapHostOperationResult LastResult-
The most recent host result, or null before the first operation.
public bool LogFailuresToConsole-
Whether a failed operation is also written to the Console as one error naming this host.
public MapPresenterBase Presenter-
The bound presenter, or null for headless use.
public MapGenerationResult Result-
The completed attempt, valid only once
IsFinishedis true. public MapUnityEvent SaveCompletedUnityEvent-
Inspector-safe counterpart to
SaveCompleted. public MapStylePreset StylePreset-
The style this host pushes to the presenter when a run starts, or null while it defers to the presenter's own style.
public MapThemeAsset Theme-
The theme compiled for runtime presentation.
public MapTraversalController TraversalController-
The bound low-level traversal controller.
Fields
public string BlueprintFingerprint-
—
public MapRuntimeContent Content-
—
public MapGenerationRequest Request-
—
public string ResolverFingerprint-
—
public StableId ResolverId-
—
public MapRuleSnapshot Rules-
—
Events
public event Action<MapTransitionEvent> AvailabilityChanged-
Forwards
MapTraversalController.AvailabilityChanged. public event Action<MapContentSelection> ContentRequested-
Raised with the durable content selection for an entered node.
public event Action<uint> DevelopmentRegenerateRequested-
Forwards
MapTraversalController.DevelopmentRegenerateRequested. public event Action<MapHostOperationResult> HostFailed-
Raised for a non-reentrant typed host failure.
public event Action<MapGraph> HostReady-
Raised after a new or restored graph is fully initialized.
public event Action<MapTransitionEvent> MapCompleted-
Forwards
MapTraversalController.MapCompleted. public event Action<MapGraph> MapGenerated-
Forwards
MapTraversalController.MapGenerated. public event Action<MapTransitionEvent> NodeCompleted-
Forwards
MapTraversalController.NodeCompleted. public event Action<MapTransitionEvent> NodeEntered-
Forwards
MapTraversalController.NodeEntered. public event Action<StableId> NodeSelectionRequested-
Forwards
MapTraversalController.NodeSelectionRequested. public event Action<MapHostOperationResult> SaveCompleted-
Raised after a save commits successfully.
public event Action<MapGraph, MapProgressionState> SaveRequested-
Forwards
MapTraversalController.SaveRequested. public event Action<MapRuntimeStateSnapshot> StateChanged-
Forwards
MapTraversalController.StateChanged. public event Action<ValidationReport> ValidationFailed-
Forwards
MapTraversalController.ValidationFailed.
Methods
public void ApplyStyle(MapStylePreset preset)-
Assigns the style this host pushes to the presenter, and pushes it straight away when a presenter is bound. Passing null hands the choice back to the presenter, whose own style is then left untouched for the rest of the run. -
preset— The style to adopt, or null to defer to the presenter's own style. public void BindScene(MapTraversalController controller, MapPresenterBase mapPresenter)-
Updates only scene-object wiring, preserving authored assets and persistence settings. -
controller— Input controller consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -mapPresenter— Input map Presenter consumed by this operation; caller ownership is retained unless the type documents a defensive copy. public MapHostOperationResult CompleteCurrent()-
Completes the current node with an empty result. - Returns — The complete map Host Operation Result outcome; inspect its typed status or diagnostics before consuming payload data.
public MapHostOperationResult CompleteCurrent(MapDataPayload resultPayload)-
Completes the current node with canonical customer result data. -
resultPayload— Input result Payload consumed by this operation; caller ownership is retained unless the type documents a defensive copy. - Returns — The complete map Host Operation Result outcome; inspect its typed status or diagnostics before consuming payload data. public void ConfigureForScene()-
Configures the serialized golden path used by the Setup Wizard. -
mapBlueprint— Input map Blueprint consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -mapTheme— Input map Theme consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -controller— Input controller consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -mapPresenter— Input map Presenter consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -pool— Input pool consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -startAutomatically— Whether start Automatically; false selects the documented conservative behavior. -slotId— Stable identifier for slot; invalid or empty IDs are rejected before mutation. public void ConfigureForScene()-
Configures the serialized golden path used by the Setup Wizard, including the run's style. -
mapBlueprint— Input map Blueprint consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -mapTheme— Input map Theme consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -mapStyle— The style pushed to the presenter when a run starts. Null leaves the presenter's own style alone. -controller— Input controller consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -mapPresenter— Input map Presenter consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -pool— Input pool consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -startAutomatically— Whether start Automatically; false selects the documented conservative behavior. -slotId— Stable identifier for slot; invalid or empty IDs are rejected before mutation. public MapHostOperationResult RequestNode(string nodeId)-
Parses a stable ID, resolves content, and requests entry into that node. -
nodeId— Stable identifier for node; invalid or empty IDs are rejected before mutation. - Returns — The complete map Host Operation Result outcome; inspect its typed status or diagnostics before consuming payload data. public MapHostOperationResult RequestNode(StableId nodeId)-
Resolves content before atomically committing traversal into an available node. -
nodeId— Stable identifier for node; invalid or empty IDs are rejected before mutation. - Returns — The complete map Host Operation Result outcome; inspect its typed status or diagnostics before consuming payload data. public void Run(object state)-
Runs the search; matches WaitCallback so it can be queued directly. -
state— Unused; required by the thread-pool delegate. public MapHostOperationResult Save()-
Persists Waybranch value atomically; an expected storage failure is reported without replacing the last valid save. - Returns — The complete map Host Operation Result outcome; inspect its typed status or diagnostics before consuming payload data.
public MapHostOperationResult Save(MapDataPayload customerMetadata)-
Persists Waybranch value atomically; an expected storage failure is reported without replacing the last valid save. -
customerMetadata— Input customer Metadata consumed by this operation; caller ownership is retained unless the type documents a defensive copy. - Returns — The complete map Host Operation Result outcome; inspect its typed status or diagnostics before consuming payload data. public void SetContentResolver(IMapNodeContentResolver resolver)-
Overrides the serialized resolver for code-driven integrations and tests. -
resolver— Input resolver consumed by this operation; caller ownership is retained unless the type documents a defensive copy. public void SetSaveAdapter(IMapSaveAdapter adapter)-
Overrides the serialized persistence choice for code-driven integrations and tests. -
adapter— Input adapter consumed by this operation; caller ownership is retained unless the type documents a defensive copy. public MapHostOperationResult StartNew()-
Runs start New against validated inputs and returns a complete result rather than exposing partially updated state. - Returns — The complete map Host Operation Result outcome; inspect its typed status or diagnostics before consuming payload data.
public MapHostOperationResult StartNew(uint seed)-
Runs start New against validated inputs and returns a complete result rather than exposing partially updated state. -
seed— Explicit unsigned deterministic seed; equal inputs and seed produce equal canonical output. - Returns — The complete map Host Operation Result outcome; inspect its typed status or diagnostics before consuming payload data. public MapHostOperationResult StartNew(uint seed, CancellationToken cancellationToken)-
Runs start New against validated inputs and returns a complete result rather than exposing partially updated state. The search still runs on the calling thread, so a wide blueprint budget holds the frame; cancelling only stops it between search steps. Use
StartNewAsync(uint, CancellationToken, Action{MapHostOperationResult})to keep the frame moving. -seed— Explicit unsigned deterministic seed; equal inputs and seed produce equal canonical output. -cancellationToken— Stops the search. A cancelled search comes back as a generation failure, never as a thrown exception or a partial map. - Returns — The complete map Host Operation Result outcome; inspect its typed status or diagnostics before consuming payload data. public IEnumerator StartNewAsync(Action<MapHostOperationResult> completed)-
Starts a new run without holding the frame: the search runs on a worker thread and the scene work happens back on the main thread once it finishes. Hand it to
MonoBehaviour.StartCoroutine(IEnumerator)and read the outcome fromcompleted. -completed— Called once on the main thread with the same result the synchronous call would have returned. Null reports nothing beyond the usual host events. - Returns — The coroutine to run; no work happens until it is started. public IEnumerator StartNewAsync()-
Starts a new run without holding the frame, on an explicit seed. No other host operation may begin while it is in flight, and cancelling the token ends the search at its next check rather than at the end of the budget. -
seed— Explicit unsigned deterministic seed; equal inputs and seed produce equal canonical output. -cancellationToken— Stops the search. A cancelled search comes back as a generation failure, never as a thrown exception or a partial map. -completed— Called once on the main thread with the same result the synchronous call would have returned. Null reports nothing beyond the usual host events. - Returns — The coroutine to run; no work happens until it is started. public MapHostOperationResult TryLoad()-
Attempts to load without throwing for expected invalid input; failure leaves output parameters at documented defaults. - Returns — Whether the operation produced every required output without changing state on failure.
IMapNodeContentResolver¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/MapContentPoolAsset.cs
Resolves one stable content ID for a node. Implementations must be deterministic and must not mutate the request or hidden global state. The host records a successful selection only after traversal accepts the node, which makes a refused or retried request safe.
IMapNodeContentSelectionValidator¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/MapContentPoolAsset.cs
Optional compatibility check used while restoring persisted selections.
MapContentPoolAsset¶
:material-star: Start here
public sealed class MapContentPoolAsset : ScriptableObject, IMapNodeContentResolver, IMapNodeContentSelectionValidator
Waybranch.Runtime · Waybranch/Runtime/Runtime/MapContentPoolAsset.cs
A dependency-free deterministic resolver authored in the Inspector. Empty type and zone filters mean "any"; a negative maximum layer means no upper bound. Eligible rows are sorted by content ID before weighted selection, so reordering Inspector rows cannot reroll a node.
Properties
public string ConfigurationFingerprint-
Canonical fingerprint of the resolver ID and every authored row. Inspector row and node-type filter order do not affect it; malformed configurations return an empty string and are refused by
WaybranchMapHost. The value is computed once and reused until the asset is edited or reconfigured, so reading it per node costs nothing. public IReadOnlyList<MapContentPoolEntry> Entries-
Authored weighted rows in Inspector order.
public StableId Id-
—
public StableId ResolverId-
Parsed resolver ID, or empty while the authored text is invalid.
public string StableIdText-
Raw stable resolver ID text.
public int Weight-
—
Methods
public void Configure(string id, IEnumerable<MapContentPoolEntry> poolEntries)-
Replaces the identity and rows for code-created assets. -
id— Input id consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -poolEntries— Ordered pool Entries input; implementations copy or enumerate it without taking caller ownership. public bool ContainsContent(StableId contentId)-
Checks row membership by stable content ID. -
contentId— Stable identifier for content; invalid or empty IDs are rejected before mutation. - Returns — only when all preconditions are satisfied; otherwise with no partial mutation. public MapContentResolutionResult Resolve(MapContentResolutionRequest request)-
Filters, validates, sorts, and deterministically selects one eligible row. -
request— Input request consumed by this operation; caller ownership is retained unless the type documents a defensive copy. - Returns — The complete map Content Resolution Result outcome; inspect its typed status or diagnostics before consuming payload data.
MapContentPoolEntry¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/MapContentPoolAsset.cs
One weighted and filtered row in a MapContentPoolAsset.
Constructors
public MapContentPoolEntry()-
Creates an immutable map Content Pool Entry snapshot; invalid required identifiers, ranges, or null inputs are rejected before state is exposed. -
contentId— Stable identifier for content; invalid or empty IDs are rejected before mutation. -weight— Positive relative selection weight; zero or negative values are rejected by validation. -nodeTypes— Ordered node Types input; implementations copy or enumerate it without taking caller ownership. -minimumLayer— Zero-based map layer index constrained by the compiled rule snapshot. -maximumLayer— Zero-based map layer index constrained by the compiled rule snapshot. -zoneId— Stable identifier for zone; invalid or empty IDs are rejected before mutation. -unique— Whether unique; false selects the documented conservative behavior. -cooldownSelections— Input cooldown Selections consumed by this operation; caller ownership is retained unless the type documents a defensive copy.
Properties
public string ContentIdText-
Raw stable content ID text.
public int CooldownSelections-
Number of intervening selections required before reuse.
public int MaximumLayer-
Inclusive maximum node layer, or -1 for no upper bound.
public int MinimumLayer-
Inclusive minimum node layer.
public IReadOnlyList<MapNodeTypeAsset> NodeTypes-
Accepted node-type assets; empty accepts every type.
public bool Unique-
Whether this content may be selected only once per run.
public int Weight-
Positive relative selection weight.
public string ZoneIdText-
Optional required zone stable ID text.
MapContentResolutionFailureKind¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/MapContentPoolAsset.cs
Why a node-content request did not produce a selection.
| Value | Meaning |
|---|---|
None |
The request produced a selection. |
InvalidRequest |
The graph, node, or history request was malformed. |
InvalidResolver |
The resolver's own identity or rows are invalid. |
Exhausted |
No row remains eligible after filters and history rules. |
ResolverFailed |
A custom resolver failed while evaluating the request. |
MapContentResolutionRequest¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/MapContentPoolAsset.cs
Immutable input to an IMapNodeContentResolver.
Constructors
public MapContentResolutionRequest()-
Copies the supplied history and pairs it with one exact graph node. -
graph— Input graph consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -node— Input node consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -zoneId— Stable identifier for zone; invalid or empty IDs are rejected before mutation. -history— Ordered history input; implementations copy or enumerate it without taking caller ownership.
Properties
public MapGraph Graph-
The immutable graph being traversed.
public IReadOnlyList<MapContentSelection> History-
Prior committed selections, copied in traversal order.
public MapNode Node-
The exact node being considered; it must come from
Graph. public StableId ZoneId-
The compiled zone containing the node layer, or an empty ID.
MapContentResolutionResult¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/MapContentPoolAsset.cs
Typed success or refusal returned by a node-content resolver.
Properties
public MapContentResolutionFailureKind FailureKind-
The refusal category, or
MapContentResolutionFailureKind.None. public MapContentSelection Selection-
The selected content, or null on failure.
public bool Succeeded-
True when a valid selection was produced.
public ValidationReport Validation-
Stable diagnostics; never null.
Methods
public static MapContentResolutionResult Failure()-
Runs failure against validated inputs and returns a complete result rather than exposing partially updated state. -
failureKind— Input failure Kind consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -validation— Input validation consumed by this operation; caller ownership is retained unless the type documents a defensive copy. - Returns — The complete map Content Resolution Result outcome; inspect its typed status or diagnostics before consuming payload data. public static MapContentResolutionResult Success(MapContentSelection selection, ValidationReport validation = null)-
Runs success against validated inputs and returns a complete result rather than exposing partially updated state. -
selection— Input selection consumed by this operation; caller ownership is retained unless the type documents a defensive copy. -validation— Input validation consumed by this operation; caller ownership is retained unless the type documents a defensive copy. - Returns — The complete map Content Resolution Result outcome; inspect its typed status or diagnostics before consuming payload data.
MapContentRoutingDiagnosticCodes¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/MapContentPoolAsset.cs
Stable diagnostics emitted by content routing.
MapContentSelection¶
:material-star: Start here
Waybranch.Runtime · Waybranch/Runtime/Runtime/MapContentPoolAsset.cs
The durable result of resolving game content for one entered node. The IDs and sequence are deliberately engine-neutral values so a host can persist them without retaining an asset or scene-object reference.
Constructors
public MapContentSelection(StableId nodeId, StableId resolverId, StableId contentId, int sequence)-
Creates an immutable map Content Selection snapshot; invalid required identifiers, ranges, or null inputs are rejected before state is exposed. -
nodeId— Stable identifier for node; invalid or empty IDs are rejected before mutation. -resolverId— Stable identifier for resolver; invalid or empty IDs are rejected before mutation. -contentId— Stable identifier for content; invalid or empty IDs are rejected before mutation. -sequence— Zero-based sequence used for deterministic ordering; negative values are invalid.
Properties
public StableId ContentId-
The customer-owned content identity to open.
public StableId NodeId-
The graph node this content belongs to.
public StableId ResolverId-
The resolver identity that produced this selection.
public int Sequence-
Zero-based position in the run's routed-content history.
Methods
public bool Equals(MapContentSelection other)-
Compares node, resolver, content, and sequence. -
other— Input other consumed by this operation; caller ownership is retained unless the type documents a defensive copy. - Returns — only when all preconditions are satisfied; otherwise with no partial mutation. public override bool Equals(object obj)-
Reports value equality with another selection. -
obj— Input obj consumed by this operation; caller ownership is retained unless the type documents a defensive copy. - Returns — only when all preconditions are satisfied; otherwise with no partial mutation. public override int GetHashCode()-
Returns a deterministic content-based hash code. - Returns — The requested immutable or borrowed value; ownership remains with the object documented by the return type.
MapHostDiagnosticCodes¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/WaybranchMapHost.cs
Stable diagnostic identifiers emitted by WaybranchMapHost.
MapHostFailureKind¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/WaybranchMapHost.cs
Why a host operation did not complete.
| Value | Meaning |
|---|---|
None |
No failure. |
OperationInProgress |
A callback attempted to nest another host operation. |
NotConfigured |
A required asset, scene binding, or adapter is absent. |
InvalidIdentifier |
A caller or serialized field supplied malformed stable-ID text. |
AuthoringInvalid |
The blueprint, rules, node types, or theme did not compile. |
GenerationFailed |
The bounded generator did not produce a graph. |
ControllerRejected |
The traversal controller refused initialization. |
SaveNotFound |
The requested save slot does not exist. |
SaveFailed |
Persistence rejected or could not complete an operation. |
ContentResolutionFailed |
The configured content resolver refused or failed a request. |
ContentStateIncompatible |
Persisted routing state cannot be used with the configured resolver. |
TransitionRejected |
The node entry or completion transition was refused. |
SaveIdentityIncompatible |
The save belongs to a different blueprint or generation configuration. |
MapHostOperationKind¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/WaybranchMapHost.cs
Controls map Host Operation Kind decisions; numeric values are serialized and must remain stable across package upgrades.
| Value | Meaning |
|---|---|
StartNew |
A new graph and traversal run were requested. |
TryLoad |
A saved run was requested. |
Save |
The current run was offered to persistence. |
RequestNode |
Traversal into one node was requested. |
CompleteCurrent |
The current node was offered a completion result. |
MapHostOperationResult¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/WaybranchMapHost.cs
Typed outcome returned by every operation on WaybranchMapHost.
Properties
public MapHostFailureKind FailureKind-
The host-level refusal category.
public string Message-
The first diagnostic message, or an empty string for a clean success.
public MapHostOperationKind Operation-
The call that produced this result.
public MapSaveFailureKind SaveFailureKind-
The storage-level refusal category for save operations.
public MapContentSelection Selection-
The newly committed routed content, only for a successful node request.
public bool Succeeded-
True exactly when no failure or error diagnostic was reported.
public ValidationReport Validation-
Stable diagnostics and context; never null.
MapHostSaveAdapterKind¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/WaybranchMapHost.cs
Which persistence source the host creates or resolves from the scene.
| Value | Meaning |
|---|---|
File |
Use crash-resistant files below Application.persistentDataPath. |
Memory |
Use an in-process adapter, primarily for previews and tests. |
Component |
Use the serialized MonoBehaviour implementing IMapSaveAdapter. |
MapHostSeedPolicy¶
Waybranch.Runtime · Waybranch/Runtime/Runtime/WaybranchMapHost.cs
Where the parameterless WaybranchMapHost.StartNew() obtains its seed.
| Value | Meaning |
|---|---|
Blueprint |
Use the seed authored on the selected blueprint. |
Fixed |
Use the fixed seed serialized on the host. |