Presentation and views¶
116 types in this area.
On this page
CanvasExperienceNodeClick · CanvasExperienceRenderer · CanvasMapEdgeView · CanvasMapNodeView · CanvasMapPresenter · DefaultMapNodeHitTester · IMapAudioCueAdapter · IMapBackgroundPresenter · IMapEdgeAvailabilityView · IMapEdgeTransitionView · IMapEdgeView · IMapEdgeViewFactory · IMapExperienceAnimationRenderer · IMapExperienceCameraRenderer · IMapExperienceConditions · IMapExperienceElementRenderer · IMapExperienceFreeRectRenderer · IMapExperienceInputOwnership · IMapExperienceInputQuery · IMapExperienceInteractiveRenderer · IMapExperienceLayoutEditingRenderer · IMapExperienceLayoutManipulationRenderer · IMapExperiencePickingRenderer · IMapExperienceRenderer · IMapExperienceStateSymbols · IMapExperienceUiInputOwnership · IMapExperienceViewportRenderer · IMapFocusIndicatorPresenter · IMapFocusView · IMapInputSource · IMapLocalizationAdapter · IMapNodeContentResolver · IMapNodeContentSelectionValidator · IMapNodeHitState · IMapNodeHitTester · IMapNodeTransitionView · IMapNodeView · IMapNodeViewFactory · IMapPresentationTransitionAdapter · IMapRoutePawnPresenter · IMapViewFactoryLifetime · IPlayerPawnPresenter · IRouteMarkerPresenter · InputSystemSignalAdapter · LegacyMapInputSource · MapCameraBloom · MapContentPoolAsset · MapContentPoolEntry · MapContentResolutionFailureKind · MapContentResolutionRequest · MapContentResolutionResult · MapContentRoutingDiagnosticCodes · MapContentSelection · MapEdgeStyle · MapEdgeViewData · MapEdgeVisualState · MapExperienceCommandResult · MapExperienceDemoControls · MapExperienceEdgeSnapshot · MapExperienceHost · MapExperienceInputGuard · MapExperienceNodeSnapshot · MapExperienceRendererRegistry · MapExperienceSnapshot · MapExperienceStateTable · MapExperienceTraversalStamp · MapExperienceVisitEvent · MapFogSettings · MapFogState · MapHostDiagnosticCodes · MapHostFailureKind · MapHostOperationKind · MapHostOperationResult · MapHostSaveAdapterKind · MapHostSeedPolicy · MapHostStarterPanel · MapInputController · MapInputFrame · MapMarkerStyle · MapMarkerSymbol · MapMeshRouteSurface · MapNavigationDirection · MapNavigationModel · MapNodeRuntimeState · MapNodeStateTint · MapNodeViewData · MapNodeVisualState · MapPresenterBase · MapRuntimeContent · MapRuntimeStateDeriver · MapRuntimeStateSnapshot · MapSelectionResult · MapSetupHierarchyBinding · MapStringUnityEvent · MapSurfaceStyling · MapTraversalController · MapUnityEvent · PassthroughLocalizationAdapter · Rule · RuntimeExperienceInputRegistry · Side · UIToolkitMapRenderer · WaybranchMapHost · World2DExperienceNodeClick · World2DExperienceRenderer · World3DEdgeFactory · World3DExperienceNodeClick · World3DExperienceRenderer · World3DMapEdgeView · World3DMapNodeView · World3DMapPresenter · World3DNodeFactory · WorldMapEdgeView · WorldMapNodeView · WorldMapPresenter · WorldMapSurface
CanvasExperienceNodeClick¶
:material-star: Start here
Waybranch.Presentation.Canvas · Runtime/Presentation/Canvas/CanvasExperienceRenderer.cs
Canvas pointer bridge for one stable node ID.
Properties
public StableId Id-
Stable ID emitted on click.
public CanvasExperienceRenderer Owner-
Owning snapshot renderer.
CanvasExperienceRenderer¶
:material-star: Start here
public sealed class CanvasExperienceRenderer : MonoBehaviour, IMapExperienceInteractiveRenderer, IMapExperienceCameraRenderer, IMapExperiencePickingRenderer, IMapExperienceLayoutEditingRenderer, IMapExperienceViewportRenderer, IMapExperienceTravelRenderer, IMapExperienceTransitions
Waybranch.Presentation.Canvas · Runtime/Presentation/Canvas/CanvasExperienceRenderer.cs
Snapshot-driven Canvas adapter with pooled node buttons and route segments.
Properties
public float MapScale-
Canvas units used for one normalized map coordinate.
Events
public event Action ConfirmRequested-
Raised when the renderer requests confirmation of the focused node.
public event Action<StableId> NodeRequested-
Raised when the renderer requests a specific node.
Methods
public void Clear()-
Clears active objects while keeping them pooled.
public void ConfigureCamera(Camera camera)-
Configures a parent Canvas for camera-backed preview rendering. -
camera— Camera used for scene-space projection. public void ConfigureViewport(Rect normalizedViewport)-
Reserves a normalized viewport for canvas presentation and applies it to the camera. -
normalizedViewport— Viewport rectangle normalized to the range 0..1. public void Confirm()-
Raises the host confirmation command.
public void HandleInput(MapInputFrame input)-
Applies pan, zoom, directional focus and submit input from the common host. -
input— Input source polled by the host. public void Present(MapExperienceSnapshot snapshot)-
Presents a snapshot and reuses prior node and segment objects. -
snapshot— Immutable experience snapshot to present or evaluate. public void SetFocus(StableId nodeId)-
Updates the scale of the focused node. -
nodeId— Stable identity of the node being entered, focused, or queried. public bool TryGetScreenPosition(StableId nodeId, out Vector2 screenPosition)-
Projects the transform of a known canvas node into screen coordinates; the lookup does not test visibility. -
nodeId— Stable identity of the node being entered, focused, or queried. -screenPosition— Screen-space position in pixels. - Returns — True when the node is known and its screen position is written; false when the node is unknown. public bool TryHit(Vector2 screenPosition, out StableId nodeId)-
Resolves a screen position to the nearest visible node. -
nodeId— Stable identity of the node being entered, focused, or queried. -screenPosition— Screen-space position in pixels. - Returns — True when a visible node was hit and its ID was written; false otherwise. public bool TryScreenToMap(Vector2 screenPosition, out Vector2 mapPosition)-
Converts a screen point to the Canvas map coordinate system. -
mapPosition— Map-space position produced by the conversion. -screenPosition— Screen-space position in pixels. - Returns — True when the screen point converts to a map position; false otherwise.
CanvasMapEdgeView¶
:material-star: Start here
public sealed class CanvasMapEdgeView : MonoBehaviour, IMapEdgeView, IMapEdgeTransitionView, IMapStyledView, IMapEdgeAvailabilityView
Waybranch.Presentation.Canvas · Runtime/Presentation/Canvas/CanvasMapViews.cs
Draws one edge between two map nodes as a chain of uGUI images, and is the edge view the Canvas presentation builds by default.
An edge is rendered as a run of straight segments through its points rather than as a single stretched sprite, so curved and elbowed connections keep an even thickness. Fog dims or hides the edge, and edges leading to an available node can animate a flow along their length to draw the eye forward.
Properties
public StableId EdgeId-
The edge this view currently stands for, taken from the last
Bind. Informational: the presenter tracks edges by its own bookkeeping and never reads it back. public bool IsTransitioning-
Whether a fog cross-fade started by
BeginTransitionis still running. The dash flow is not counted, so a settled edge reports false while it goes on flowing. public IReadOnlyList<NormalizedMapPosition> Points-
The path last bound, in normalized layout space, running from the edge's source endpoint to its target. Read-only and owned by the bind data, so it does not change until the next bind.
public IReadOnlyList<Vector2> RenderedPoints-
The same path in the anchored positions the segments were actually laid out along, so anything you place on the route -- a traveller, a label, a marker -- can follow the drawn line without repeating the conversion. This is the view's own buffer rather than a copy, and it is rebuilt on every bind, so take a copy of it if you need it to outlive one.
public Transform Transform-
The edge's own transform. The factory parents it under the edge root and pushes it to the front of the sibling order, which in uGUI draws it first and so keeps routes behind the nodes they connect.
Methods
public void AdvanceTransition(float deltaSeconds)-
Advances a fog cross-fade in flight and, when one that ends hidden lands, deactivates the edge. The presenter drives this once a frame on an unscaled delta, so pausing the game does not strand an edge mid-fade. A negative delta counts as none. -
deltaSeconds— Seconds since the previous advance. public void ApplyStyle(CompiledMapStyle style)-
Supplies the style this edge draws with. -
style— Compiled edge width, dash, glow, and motion tokens to apply to every active segment. public void BeginTransition(MapFogState fromFog, MapFogState toFog, float durationSeconds)-
Cross-fades the edge into the fog state it has just been bound in, and owns its own visibility while doing so. The edge is kept active for the whole fade even when it is on its way to hidden, and deactivated only once the fade lands, so a route fading out is never cut off part-way. A duration of zero or less, or two fog states that resolve to the same colour, applies the destination and its visibility at once. -
fromFog— Previous fog state used to derive the starting route colour when no interrupted fade was captured. -toFog— New fog state whose bound colour and visibility become terminal state. -durationSeconds— Fade time in seconds; zero or less applies the destination immediately. public void Bind(MapEdgeViewData data)-
Rebuilds pooled Canvas segments for an edge's resolved path, colour, fog state, and presentation coordinates. -
data— Edge snapshot containing its stable ID, normalized path, optional resolved points, base colour, and current fog. public void CancelTransition(bool applyTerminalState)-
Abandons a fog cross-fade in flight, before the edge is bound again or handed back to its factory. -
applyTerminalState— True to finish by applying the destination colour together with the visibility that belongs to it, which for an edge on its way to hidden means deactivating it; false to leave the edge exactly as it is, because another fade is about to start from there. public void PrepareForBind()-
Records the colour the segments are showing right now, immediately before a bind that changes fog state, so the fade that follows can carry on from a fade already in flight. An edge with no segments yet -- the state it is in before its first bind -- records fully transparent.
public void RestoreAfterUnchangedBind()-
Re-activates the edge and puts back the colour
PrepareForBindcaptured, for a bind that turned out not to change fog state, so a fade in flight is not cut short. Safe to call with nothing captured and with nothing fading, in which case it only clears the capture. public void SetActive(bool active)-
Shows or hides the edge's whole GameObject. Because this view animates its own fog changes, the presenter stops toggling it on a fog change and leaves visibility to the transition, so in practice this is the pooling switch. It has to be reversible: the same instance is handed back out later. -
active— False to park the edge, typically because its factory has taken it back. public void SetLeadsToAvailable(bool value)-
Marks this route as leading to a reachable node. Routes to reachable nodes are drawn thicker and, when the style asks for it, flow toward the destination so the next choice reads at a glance. -
value— True when the target node is currently reachable and the route should receive available-route emphasis. public void TickStyle(float presentationDeltaSeconds)-
Advances dash flow by a presentation delta. -
presentationDeltaSeconds— Presentation-clock seconds used to move the dash phase along reachable routes.
CanvasMapNodeView¶
:material-star: Start here
public sealed class CanvasMapNodeView : MonoBehaviour, IMapNodeView, IMapNodeHitState, IMapNodeTransitionView, IMapFocusView, IMapStyledView
Waybranch.Presentation.Canvas · Runtime/Presentation/Canvas/CanvasMapViews.cs
Draws one map node as a uGUI element inside a Canvas, and is the node view the Canvas presentation builds by default.
It owns everything about a node the player can see: position, size, colour, icon, label, fog, and the focus and transition animations. Sizes and colours come from the compiled style rather than from the caller, so a current node can read larger and brighter than a locked one without anyone computing that.
Replace it by supplying your own IMapNodeView when you want a
different look; see the World2D counterpart World2D.WorldMapNodeView
for the world-space equivalent.
Properties
public string DisplayLabel-
The label last bound, already through the localization adapter. Empty when the node type declares none; the label is also left undrawn when the style's treatment for the current visual state suppresses it.
public MapFogState FogState-
How fog is treating the node. A dimmed node is drawn at three quarters of its colour's alpha and a hidden one at zero, so a hidden node is transparent rather than deactivated: it stops being clickable instead.
public bool IsHitTestVisible-
Whether a click on the node should count. False while fog hides it and false while its graphic is not a raycast target, so a node the player cannot see cannot be selected by accident.
public bool IsTransitioning-
Whether a colour cross-fade started by
BeginTransitionis still running. Focus easing and the current-node pulse are not counted, so a settled node reports false while it goes on pulsing. public StableId NodeId-
The node this view currently stands for, taken from the last
Bind. Empty until the first bind, which is what keeps an unbound pooled instance out of hit testing. public NormalizedMapPosition NormalizedPosition-
Where the presenter laid the node out, in normalized layout space: the layout-space coordinate rather than the pixels the node ended up at. The shipped presenters resolve the placement themselves and send it with the bind, and the node is drawn at that; this value is only converted against the parent rect when the bind data carries no presentation position.
public string Tooltip-
The tooltip last bound, already localized. Kept for a host that draws its own tooltips; this view never renders it.
public Transform Transform-
The node's own transform. Input resolves a click to this node through it, and the factory parents and orders the node by it, so it stays valid for the component's whole lifetime.
public MapNodeVisualState VisualState-
The traversal state the node was last bound in: hidden, locked, available, current, visited or completed. It is the destination of a state change, not what is on screen: the bind runs before the cross-fade, so this already reads the new state while the colour is still travelling towards it.
Fields
public const float FocusOvershoot-
Overshoot applied at the start of a focus settle.
public const float FocusScale-
Scale applied to a focused node.
Methods
public void AdvanceTransition(float deltaSeconds)-
Advances a colour cross-fade in flight, interpolating straight from the captured start colour to the destination. The presenter drives this once a frame on an unscaled delta, so pausing the game does not strand a node mid-fade. A negative delta counts as none, and the fade stops the moment it reaches the destination. -
deltaSeconds— Seconds since the previous advance. public void ApplyStyle(CompiledMapStyle style)-
Supplies the style this node draws with. Optional: without a style the node still renders a flat tinted shape, which is what the headless tests assert against. -
style— Compiled palette, node treatment, and motion tokens used by later binds and animation ticks; null keeps the flat fallback. public void BeginTransition(MapNodeVisualState fromVisual, MapFogState fromFog, MapNodeVisualState toVisual, MapFogState toFog, float durationSeconds)-
Cross-fades the node's colour into the state it has just been bound in, carrying the icon and label alpha along with it. The bind has already applied the destination colour, so the fade works by putting the starting colour back and easing forward from there. A fade interrupted part-way resumes from the colour
PrepareForBindcaptured, which is what stops states that change in quick succession from jumping. A duration of zero or less, or two states that resolve to the same colour, applies the destination at once and leavesIsTransitioningfalse. -fromVisual— Traversal visual state whose styled colour is the fade's normal starting point. -fromFog— Prior fog state combined withfromVisualto calculate the starting alpha. -toVisual— New traversal visual state already applied by the preceding bind. -toFog— New fog state combined withtoVisualto calculate the terminal colour and alpha. -durationSeconds— Fade time in seconds; zero or less applies the destination immediately. public void Bind(MapNodeViewData data)-
Binds node identity, layout, visual state, localized text, icon, and hit testing to this pooled Canvas view. -
data— Presenter snapshot containing the node, node type, resolved position, size, fog, visual state, and localized copy. public void CancelTransition(bool applyTerminalState)-
Abandons a cross-fade in flight, before the node is bound again or handed back to its factory. Focus scale and the pulse are left alone. -
applyTerminalState— True to finish by applying the destination colour, which is what the shipped factory does when it pools a node so the next reuse starts from a settled look; false to leave the node showing the colour the fade had reached, because another fade is about to start from there. public void PrepareForBind()-
Records the colour on screen right now, immediately before a bind that changes state, so the cross-fade that follows can carry on from a fade already in flight instead of snapping back to the old state. Does nothing on a node that has no graphic yet.
public void RestoreAfterUnchangedBind()-
Puts back the colour
PrepareForBindcaptured, for a bind that turned out not to change state, so a fade in flight is not cut short. Safe to call with nothing captured and with nothing fading, in which case it only clears the capture. public void SetActive(bool active)-
Shows or hides the node's whole GameObject. This is not how fog is applied: the presenter activates a node after every bind, a fogged one included, and hiding is done with alpha instead. In practice this is the pooling switch, so it has to be reversible -- the same instance is handed back out later. -
active— False to park the node, typically because its factory has taken it back. public void SetFocused(bool focused)-
Shows or clears the keyboard and gamepad focus treatment, by scaling the node to
FocusScale. The scale jumps past its destination byFocusOvershooton the frame focus changes and eases back over the style's focus time, so selection reads as immediate instead of as a slow grow. Being told the value it already has re-applies the settled scale without restarting that motion, and with no style, or a focus time of zero, the new scale is simply applied at once. -focused— True while this is the focused node. public void TickStyle(float deltaSeconds)-
Advances focus tweening and the current-node pulse. Driven by the presenter's visual clock so pausing the game pauses the map, and so tests can step it deterministically. -
deltaSeconds— Non-negative presentation-clock seconds used to advance focus easing and the current-node pulse.
CanvasMapPresenter¶
:material-star: Start here
Waybranch.Presentation.Canvas · Runtime/Presentation/Canvas/CanvasMapPresenter.cs
Draws a map inside a uGUI Canvas. Nodes become Image-backed views pooled per node type, routes become chains of thin rotated rects drawn from a pool of their own, and both are parented to the node and edge roots, so a map takes part in the same hierarchy, batching, and sorting as the rest of your interface. A node type carrying a Canvas prefab is instantiated instead of the built-in view, which is how a project replaces the look without replacing the presenter.
It also sizes the two roots. Whenever the graph's topology changes, the node and edge RectTransforms are resized to the extent the graph and theme produce, which is what lets a ScrollRect or layout group above them pan and clamp against the real size of the map. A root that is not a RectTransform is left alone rather than treated as a mistake, so the presenter still works when both roots are the presenter's own transform.
Everything else -- binding to the traversal controller, fog and visual state, transitions,
focus, and styles -- comes from MapPresenterBase. Use
Waybranch.Presentation.World2D.WorldMapPresenter instead for a map drawn in
the scene rather than on a Canvas.
DefaultMapNodeHitTester¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/DefaultMapNodeHitTester.cs
The shipped hit tester. It considers the active IMapNodeView
components on this object and its children, and covers both presentation styles:
Canvas views by rectangle, World2D views by the bounds of the renderers they draw
with (a renderer that is switched off takes no press) - except a styled built-in
World2D node, which takes a press on the node itself and on what else it draws (its
icon, its label, the art of a node prefab), not on the glow and shadow its styled
surface draws around it. Candidates are
visited topmost first, so an overlapping node cannot steal a press. A view that
also implements IMapNodeHitState decides its own eligibility;
otherwise a view whose renderers are all disabled is skipped.
Properties
public Camera EventCamera-
The camera screen positions are interpreted through. When it is null the tester resolves one itself:
Camera.main, else the first active camera in a stable order.
Methods
public void BindCamera(Camera value)-
Sets the camera used for non-overlay Canvas and World2D hit conversion. -
value— The explicit event camera, or null to use deterministic automatic resolution on each hit. public bool TryHit(Vector2 screenPosition, out StableId nodeId)-
Finds the topmost node view containing a screen position. It allocates a candidate list and queries the hierarchy per call, which is why the controller only calls it on frames that carry a press. -
screenPosition— Pointer position in screen pixels. -nodeId— Receives the topmost eligible node, or an empty ID when no active view contains the point. - Returns — True when a node was hit.
IMapAudioCueAdapter¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Plays the cue ids authored on node types, so the package never has to know which audio system a project uses.
The traversal controller calls it while dispatching a transition: once when a node is entered and once when it is completed, and only for a node type that declares a cue id which parses as a stable id. An exception is caught and surfaced as a callback-failed warning instead of rolling the transition back, and driving traversal from inside the call is refused as a nested operation.
Methods
public void Play(StableId cueId)-
Plays one cue. -
cueId— A non-empty stable cue identifier from the compiled node type; the adapter maps it to project-owned audio content.
IMapBackgroundPresenter¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Optional hook for drawing whatever sits behind the map: a backdrop image, a parallax layer, a shader quad.
Called once at the end of every presented pass, not every frame, and always
with the theme currently in force - so an implementation must tolerate being
handed the same theme repeatedly and should do nothing when it has not changed.
A background presenter that also implements IMapStyledView
receives the map's style the same way views do.
Methods
public void Present(CompiledMapTheme theme)-
Draws or refreshes the backdrop for the theme now in force. -
theme— The immutable compiled theme for the current presentation pass; implementations should tolerate repeated references.
IMapEdgeAvailabilityView¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapStyledViewContracts.cs
Implemented by an edge view that can emphasize routes leading to a reachable node.
Separate from IMapStyledView so a custom edge view can adopt
styling without also having to reason about availability, and vice versa.
Methods
public void SetLeadsToAvailable(bool leadsToAvailable)-
Marks whether this route's destination is currently reachable. Display only: it never influences traversal legality, which the session owns. The presenter calls this just before it binds the edge, and may repeat a value that has not changed, so an implementation should be cheap and tolerate being told the same thing twice. -
leadsToAvailable— Whether the edge's target is currently a valid traversal destination.
IMapEdgeTransitionView¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Optional on an IMapEdgeView: the edge counterpart of
IMapNodeTransitionView, driven in the same order and under the same
condition that no IMapPresentationTransitionAdapter is installed.
An edge only ever transitions between fog states. When one is implemented the presenter stops toggling the edge active on a fog change and leaves visibility to the animation, so a transition to hidden must end with the edge invisible.
Properties
public bool IsTransitioning-
Whether an animation this view owns is still running. The presenter does not consult it.
Methods
public void AdvanceTransition(float deltaSeconds)-
Advances an animation in flight. Driven once a frame from the presenter with an unscaled delta, so it must cope with a zero delta and with a very large one. -
deltaSeconds— Non-negative unscaled elapsed time, in seconds, since the previous presentation update. public void BeginTransition(MapFogState fromFog, MapFogState toFog, float durationSeconds)-
Starts animating from the old fog state to the new one, after the bind has applied the destination. -
durationSeconds— Requested unscaled animation duration in seconds; zero should finish immediately. -fromFog— The visibility state captured before the new bind. -toFog— The visibility state in the newly bound data. public void CancelTransition(bool applyTerminalState)-
Abandons any animation in flight, before a re-bind or when the view goes back to its factory. -
applyTerminalState— True to finish by showing the destination look, which for a hidden edge means invisible; false to leave the view as it is. public void PrepareForBind()-
Captures whatever the view is showing right now, immediately before a bind that changes fog state, so the transition that follows can start from the mid-animation look.
public void RestoreAfterUnchangedBind()-
Puts back the look captured by
PrepareForBindwhen the bind that followed turned out not to change fog state. Implementations must tolerate being called with nothing captured; the shipped presenter never calls it.
IMapEdgeView¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
The contract for anything that draws a single map edge. Implement it to draw
routes your own way - a line renderer, a UI mesh, a chain of sprites - and hand
instances to the presenter through an IMapEdgeViewFactory.
Unlike a node view, an edge view really is deactivated when fog hides it, so
SetActive must be reversible rather than a teardown.
Properties
public StableId EdgeId-
The edge this view currently represents, taken from the data it was bound with. Informational: the presenter tracks edges itself and never reads this.
public Transform Transform-
The view's transform, used for parenting and draw order.
Methods
public void Bind(MapEdgeViewData data)-
Replaces the route geometry, color, and fog treatment in one call. The supplied point collections are stable snapshots, so the view never needs to query the graph while drawing. -
data— The edge path, resolved color, and fog state to display; a later bind replaces it in full. public void SetActive(bool active)-
Shows or hides the view. Must be reversible: an edge hidden by fog is deactivated and the same instance is shown again when fog lifts. A view that implements
IMapEdgeTransitionViewis left to manage its own visibility instead. -active— True to show the pooled edge view; false to hide it without destroying it.
IMapEdgeViewFactory¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Creates and reclaims edge views for a presenter. A factory may pool instances; returning null intentionally omits an edge for the current pass.
Methods
public IMapEdgeView Create(Transform parent)-
Supplies a view for one edge. -
parent— The presenter-owned transform under which the returned edge view must be placed. - Returns — The view to bind, or null to have the presenter silently skip this edge for this pass. public void Release(IMapEdgeView view)-
Hands a view back when the presenter no longer needs it. Pool it or destroy it, but do not throw: release runs during a rebuild and during teardown. -
view— The exact instance previously returned byCreate; cancel any factory-owned work before pooling or destroying it.
IMapExperienceAnimationRenderer¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/IMapExperienceAnimationRenderer.cs
Advances renderer-owned presentation animation without changing game state.
Methods
public void TickPresentation(float deltaSeconds)-
Advances transient visual animation by the supplied unscaled delta. -
deltaSeconds— Elapsed presentation time in seconds since the previous tick.
IMapExperienceCameraRenderer¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Optional renderer capability for scene and preview camera setup.
Methods
public void ConfigureCamera(Camera camera)-
Configures the camera used for projection and presentation. -
camera— Camera used for scene-space projection.
IMapExperienceConditions¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Typed game integration for conditions and content without reflection.
Methods
public bool CanEnter(StableId nodeId, MapExperienceSnapshot snapshot)-
Determines entry using the complete policy snapshot before game conditions filter availability. The same context is supplied during presentation and command revalidation. -
nodeId— Stable identity of the node being entered, focused, or queried. -snapshot— Immutable experience snapshot to present or evaluate. - Returns — True when the condition provider allows entry for the node and snapshot. public bool TryComplete(StableId nodeId, out string reason)-
Checks completion conditions for a node and writes a diagnostic reason when completion is refused. -
nodeId— Stable identity of the node being entered, focused, or queried. -reason— Failure explanation written when completion is refused. - Returns — True when completion is accepted; false with a reason when the condition rejects it.
IMapExperienceElementRenderer¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Mounts a document renderer in an editor panel using the same live visual tree.
Methods
public void AttachTo(UnityEngine.UIElements.VisualElement target)-
Attaches the owned visual tree to the supplied panel. -
target— Parent element that receives the renderer's owned visual tree.
IMapExperienceFreeRectRenderer¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Optional free area of a full-screen presentation that draws through its own camera.
Methods
public void ConfigureFreeRect(Rect normalizedFreeRect)-
Frames the map inside a normalized screen rectangle with a bottom-left origin while the camera keeps the whole screen, so the scene behind the interface stays full-bleed and only the nodes, routes and captions are kept in the free area. -
normalizedFreeRect— A nonempty rectangle within the unit screen.
IMapExperienceInputOwnership¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Allows one input owner to suppress a renderer's duplicate keyboard polling.
Methods
public void SetHostInputOwnership(bool ownsInput)-
True delegates keyboard and viewport signals to the host. -
ownsInput— Whether this renderer currently owns host input.
IMapExperienceInputQuery¶
Waybranch.Runtime · Runtime/Runtime/Experience/IMapExperienceInputQuery.cs
Keyboard and pointer queries for the conveniences of the shipped experience HUDs that a map's
IMapInputSource does not carry: Tab to move focus, Escape to go back, focus under the pointer and the
press of a 3D marker. The members follow the legacy Input class. The Input System integration registers one through
RuntimeExperienceInputRegistry.RegisterInputQuery, so these conveniences also work in a project that
uses the Input System only; where the Input Manager is enabled, the HUDs read legacy Input as before.
Methods
public bool GetKey(KeyCode key)-
Whether the key is held. -
key— Key to query; a key the implementation cannot map reads as not held. - Returns — True while the key is down. public bool GetKeyDown(KeyCode key)-
Whether the key went down during this frame. -
key— Key to query; a key the implementation cannot map reads as not pressed. - Returns — True only in the frame the key was pressed. public bool GetPointerButton(int button)-
Whether the pointer button is held. -
button— 0 for the primary press (left mouse button, pen tip or touch), 1 for the right and 2 for the middle mouse button. - Returns — True while the button is down. public bool GetPointerButtonDown(int button)-
Whether the pointer button went down during this frame. -
button— 0 for the primary press (left mouse button, pen tip or touch), 1 for the right and 2 for the middle mouse button. - Returns — True only in the frame the button was pressed. public bool TryGetPointerPosition(out Vector2 screenPosition)-
Reads the position of the current pointer. -
screenPosition— Pointer position in screen pixels, or zero when there is no pointer. - Returns — True when a pointer device exists.
IMapExperienceInteractiveRenderer¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Optional renderer capabilities for real-time input and camera configuration.
Methods
public void HandleInput(MapInputFrame input)-
Applies one package-neutral input frame. -
input— Input source polled by the host.
IMapExperienceLayoutEditingRenderer¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Converts a pointer to layout coordinates for visual authoring without changing topology.
Methods
public bool TryScreenToMap(Vector2 screenPosition, out Vector2 mapPosition)-
Projects a camera-screen position onto the renderer's map plane. -
mapPosition— Map-space position produced by the conversion. -screenPosition— Screen-space position in pixels. - Returns — True when the screen point converts to a map position; false otherwise.
IMapExperienceLayoutManipulationRenderer¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Optional editor gesture surface for changing presentation offsets with undo.
Events
public event Action<StableId, Vector2> NodeOffsetRequested-
Emits one normalized map-space delta when an editor drag ends.
Methods
public void SetLayoutEditingEnabled(bool enabled)-
Enables or disables the editor-only Ctrl-drag gesture. -
enabled— Whether layout editing is enabled.
IMapExperiencePickingRenderer¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Screen projection and picking shared by editor previews and runtime input.
Methods
public bool TryGetScreenPosition(StableId nodeId, out Vector2 screenPosition)-
Projects a known node into camera screen coordinates; projection success does not guarantee visibility. -
nodeId— Stable identity of the node being entered, focused, or queried. -screenPosition— Screen-space position in pixels. - Returns — True when the renderer can project the node and writes its position; false otherwise. Check viewport and visibility separately when placing overlays. public bool TryHit(Vector2 screenPosition, out StableId nodeId)-
Resolves a visible node in camera screen coordinates. -
nodeId— Stable identity of the node being entered, focused, or queried. -screenPosition— Screen-space position in pixels. - Returns — True when a visible node was hit and its ID was written; false otherwise.
IMapExperienceRenderer¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Renderer boundary independent of Unity Transform and presentation assemblies.
Events
public event Action ConfirmRequested-
Raised when the renderer requests confirmation of the focused node.
public event Action<StableId> NodeRequested-
Raised when the renderer requests a specific node.
Methods
public void Clear()-
Releases presentation-owned runtime objects.
public void Present(MapExperienceSnapshot snapshot)-
Presents the latest immutable snapshot. -
snapshot— Immutable experience snapshot to present or evaluate. public void SetFocus(StableId nodeId)-
Updates presentation focus without changing progression. -
nodeId— Stable identity of the node being entered, focused, or queried.
IMapExperienceStateSymbols¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Tells an interface whether a presentation draws state symbols on its nodes, so a legend only shows what the map shows.
Properties
public bool DrawsStateSymbols-
Whether the presentation currently draws a symbol (triangle, diamond, cross or square) next to each node.
IMapExperienceUiInputOwnership¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Distinguishes map input from other controls sharing a UI Toolkit panel.
Methods
public bool OwnsElement(UnityEngine.UIElements.VisualElement element)-
True for a map node or its pan surface; false for surrounding game UI. -
element— UI element whose ownership is being queried. - Returns — Result of the operation; false or a refusal leaves owned state unchanged.
IMapExperienceViewportRenderer¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Optional presentation area reserved by a game's surrounding interface.
Methods
public void ConfigureViewport(Rect normalizedViewport)-
Frames the map inside a normalized screen rectangle with a bottom-left origin. -
normalizedViewport— A nonempty rectangle within the unit screen. Does not change map or save coordinates.
IMapFocusIndicatorPresenter¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Optional hook for one shared focus indicator drawn at the focused node, as an alternative to every node styling its own focus.
Called when focus moves, once per presented pass, and once more when the presenter clears the map - that last call arrives with an empty node id and a null layout and means "hide yourself", so an implementation must handle it.
Methods
public void Present(StableId focusedNodeId, MapLayout layout)-
Places the focus indicator. -
focusedNodeId— The navigation-focused node, or an empty ID to hide the shared focus indicator. -layout— Layout positions for the presented graph, before the style's flow direction is applied, or null once the presenter has cleared the map;MapPresenterBase.TryGetDrawnNodePositiongives where the focused node is drawn.
IMapFocusView¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Optional on an IMapNodeView: lets a view show keyboard or gamepad
focus.
The presenter drives it when focus moves and again on each presented pass for nodes that did not otherwise change, so an implementation must be cheap and must tolerate being told the same value repeatedly. A node hidden by fog is never reported as focused.
Methods
public void SetFocused(bool focused)-
Shows or clears the focus treatment. Called with the same value repeatedly, so do not restart an animation unless the value actually changed. -
focused— True while keyboard/gamepad navigation targets this node; false removes the focus treatment.
IMapInputSource¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapInput.cs
Supplies the map with input frames. Implement this to drive a map from any input stack - legacy Input, Input System, a recorded replay, a test - without the package taking a dependency on it.
Methods
public MapInputFrame Capture()-
Returns the frame for the current update.
MapInputControllercalls this once perUpdateand applies the result straight away, so treat the call as consuming: report submit and pointer presses as one-frame edges, and reset the pan and zoom deltas you accumulated. An implementation that keeps returning the same deltas keeps moving the map after the player has stopped. It runs every frame, so keep it cheap. - Returns — A value snapshot for exactly one controller update; edge signals and accumulated deltas should be cleared by the source after returning it.
IMapLocalizationAdapter¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Bridges node labels and tooltips to whatever localization system a project already uses. Without one, the text authored on the node type is shown as-is.
Resolve is called twice for every node the presenter binds, so it
must be cheap, and nothing guards it: an exception thrown from it abandons the
presentation pass part-way through.
Methods
public string Resolve(string key, string fallback)-
Resolves one display string. -
key— The authored localization key; it may be empty when content only supplies fallback text. -fallback— The authored display text to use when the key is absent or unresolved. - Returns — The text to display. A null return is stored as an empty string.
IMapNodeContentResolver¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · 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.
Properties
public string ConfigurationFingerprint-
Lowercase SHA-256 of every setting that can affect selection. Change it whenever custom resolver data or behavior changes so saved runs fail closed instead of silently rerolling.
public StableId ResolverId-
Stable identity persisted with every selection.
Methods
public MapContentResolutionResult Resolve(MapContentResolutionRequest request)-
Deterministically resolves content without mutating hidden state. -
request— Graph node, containing zone, and copied selection history that constrain the deterministic choice. - Returns — A typed selection or refusal; implementations must not mutate the request or hidden state.
IMapNodeContentSelectionValidator¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapContentPoolAsset.cs
Optional compatibility check used while restoring persisted selections.
Methods
public bool ContainsContent(StableId contentId)-
Reports whether a persisted content ID still exists. -
contentId— Persisted customer content identity whose continued availability is checked. - Returns — only when all preconditions are satisfied; otherwise with no partial mutation.
IMapNodeHitState¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Optional on an IMapNodeView: lets the view decide for itself
whether it can be clicked.
Implementing it replaces the default hit tester's own guess, which is drawn from the view's rect or renderers. That cuts both ways: a view that reports true for a node hidden by fog makes that node clickable, so the usual rule is to report false for anything the player must not be able to reach.
Properties
public bool IsHitTestVisible-
Whether this view may currently receive a click. Read for every candidate view on every hit test, so keep it a cheap check with no side effects.
IMapNodeHitTester¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapInput.cs
Resolves a screen position to a map node. Implement this when node views are drawn in a way the shipped tester cannot see, such as a custom mesh or an off-hierarchy renderer.
Methods
public bool TryHit(Vector2 screenPosition, out StableId nodeId)-
Reports the node under a screen position, topmost first where views overlap. The controller calls this only on frames that carry a press and no pinch, and a hit becomes the focused node and is submitted immediately (fog-hidden nodes are rejected before that), so return only nodes the player can see and press. Break ties deterministically - the shipped tester falls back to node id - so the same press always resolves to the same node. -
screenPosition— Pointer position in screen pixels. -nodeId— Receives the visible node under the pointer, or an empty ID when the method returns false. - Returns — True when a node was hit.
IMapNodeTransitionView¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Optional on an IMapNodeView: lets a view animate its own state
changes, which is how the shipped node views cross-fade.
Consulted only while no IMapPresentationTransitionAdapter is
installed. The presenter drives it in a fixed order:
PrepareForBind before a bind that changes state, then
BeginTransition after that bind, then
AdvanceTransition once a frame on an unscaled delta so that
pausing the game does not freeze the map. Reaching the destination is the
view's own responsibility; nothing polls it to check that it got there.
Properties
public bool IsTransitioning-
Whether an animation this view owns is still running. The presenter does not consult it, so it is informational for a host that needs to know whether the map has settled.
Methods
public void AdvanceTransition(float deltaSeconds)-
Advances an animation in flight. Driven once a frame from the presenter with an unscaled delta, so it must cope with a zero delta and with a very large one after a stall. -
deltaSeconds— Non-negative unscaled elapsed time, in seconds, since the previous presentation update. public void BeginTransition(MapNodeVisualState fromVisual, MapFogState fromFog, MapNodeVisualState toVisual, MapFogState toFog, float durationSeconds)-
Starts animating from the old visual and fog state to the new one. The bind that preceded it has already applied the destination look. -
durationSeconds— Requested unscaled animation duration in seconds; zero should finish immediately. -fromVisual— The visual role captured before the new bind. -fromFog— The visibility state captured before the new bind. -toVisual— The visual role in the newly bound data. -toFog— The visibility state in the newly bound data. public void CancelTransition(bool applyTerminalState)-
Abandons any animation in flight, before a re-bind or when the view goes back to its factory. -
applyTerminalState— True to finish by showing the destination look; false to leave the view as it is because a new transition is about to start. public void PrepareForBind()-
Captures whatever the view is showing right now, immediately before a bind that changes state, so the transition that follows can start from the mid-animation look instead of snapping to the old state.
public void RestoreAfterUnchangedBind()-
Puts back the look captured by
PrepareForBindwhen the bind that followed turned out not to change state, so an animation in flight is not cut short. Implementations must tolerate being called with nothing captured. The shipped presenter only prepares binds that do change state, so it never calls this.
IMapNodeView¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
The contract for anything that draws a single map node. Implement it to render
nodes your own way - a prefab, a sprite, a UI element - and hand instances to
the presenter through an IMapNodeViewFactory.
An implementation must report NodeId from the data it was bound
with and keep Transform non-null for its lifetime: input
resolves a click to a node through those two members and nothing else. Beyond
them the presenter never inspects the object, so a view is free to render
however it likes.
Properties
public StableId NodeId-
The node this view currently represents, taken from the data it was bound with. Hit testing skips a view whose id is still empty.
public Transform Transform-
The transform input hit-tests against. Must stay non-null for the view's lifetime.
Methods
public void Bind(MapNodeViewData data)-
Replaces the node's drawn identity, placement, localized text, progression treatment, and fog treatment in one call. Implementations should not retain mutable references or query traversal state while drawing. -
data— The node, placement, text, fog, and visual state to display; a later bind replaces it in full. public void SetActive(bool active)-
Shows or hides the view. Must be reversible: a pooling factory deactivates a released view and may hand the same instance back later. The presenter activates a node view after every
Bind, including for a node hidden by fog, so rendering a hidden node as invisible is the view's own job. -active— True to make the pooled view participate in rendering and input; false to hide it without destroying it.
IMapNodeViewFactory¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Creates and reclaims node views for a presenter. Implementations may instantiate, pool, or adapt existing objects; returning null intentionally omits that node without changing map state.
Methods
public IMapNodeView Create(CompiledMapNodeType nodeType, Transform parent)-
Supplies a view for a node of the given compiled type. -
nodeType— Compiled type metadata used to choose an appropriate prefab or view implementation. -parent— The presenter-owned transform under which the returned view must be placed. - Returns — The view to bind, or null to have the presenter silently skip this node for this pass. public void Release(IMapNodeView view)-
Hands a view back when the presenter no longer needs it. Pool it or destroy it, but do not throw: release runs during a rebuild and during teardown, and nothing there catches an exception. Any transition on the view has already been cancelled, and a pooled view is always bound again before it is shown, so it does not have to be reset here. -
view— The exact instance previously returned byCreate; it will not be used again unless the factory returns it later.
IMapPresentationTransitionAdapter¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Takes over every node and edge state transition for the whole map, as an alternative to letting each view animate itself.
Installing one switches the per-view path off completely: the presenter then
never calls IMapNodeTransitionView or
IMapEdgeTransitionView, and never advances a view's animation. The
adapter therefore owns its own clock and must carry its animations to completion
itself. Durations come from the theme and can be zero, which means "apply the
destination immediately".
Methods
public void CancelEdge(IMapEdgeView view, bool applyTerminalState)-
Stops whatever is animating on an edge view, before it is re-bound or released. -
applyTerminalState— True to leave the destination look applied; false when a fresh transition is about to start. -view— The edge view whose adapter-owned animation must stop synchronously. public void CancelNode(IMapNodeView view, bool applyTerminalState)-
Stops whatever is animating on a node view, before it is re-bound or released. -
applyTerminalState— True to leave the destination look applied; false when a fresh transition is about to start from where this one stopped. -view— The node view whose adapter-owned animation must stop synchronously. public void TransitionEdge(IMapEdgeView view, MapFogState fromFog, MapFogState toFog, float durationSeconds)-
Animates one edge between fog states. The presenter activates the edge before calling, even when it is on its way to hidden, so leaving a hidden edge invisible afterwards is the adapter's responsibility. -
durationSeconds— Requested unscaled animation duration in seconds; zero means apply the destination immediately. -view— The already rebound and active edge view whose visibility the adapter now owns. -fromFog— The visibility state shown before the bind. -toFog— The destination visibility state represented by the current bind data. public void TransitionNode(IMapNodeView view, MapNodeVisualState fromVisual, MapFogState fromFog, MapNodeVisualState toVisual, MapFogState toFog, float durationSeconds)-
Animates one node from its previous look to its new one. The view has already been bound to the destination state and activated, so the adapter is overriding an appearance that is already final and correct. -
durationSeconds— Requested unscaled animation duration in seconds; zero means apply the destination immediately. -view— The already rebound and active node view whose appearance the adapter now owns. -fromVisual— The visual role shown before the state change. -fromFog— The visibility state shown before the state change. -toVisual— The visual role represented by the view's current bind data. -toFog— The destination visibility state represented by the current bind data.
IMapRoutePawnPresenter¶
:material-star: Start here · :material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
An IPlayerPawnPresenter that also wants to know how the traveller
arrived, which is what a pawn needs in order to walk the route instead of sliding
across the map in a straight line.
The presenter calls this overload instead of the shorter one whenever the pawn
implements it, so a pawn that only cares about the route can forward the shorter
one to this one and be done. The edge id is empty for the first node of a run,
while the traveller is between nodes, and whenever no drawn route joins the two
nodes; hand it to MapPresenterBase.TryGetEdgePath to get the path the edge
is actually drawn along.
Methods
public void Present(StableId previousNodeId, StableId currentNodeId, StableId edgeId, MapLayout layout)-
Places the traveller's marker, saying which route it took to get there. -
previousNodeId— The node the traveller came from, or an empty ID when it came from nowhere. -currentNodeId— The current node, or an empty ID when the traveller is between nodes and the pawn should be hidden. -edgeId— The edge crossed to reachcurrentNodeId, or an empty ID when no drawn route joins the two nodes. -layout— Layout positions for the presented graph, before the style's flow direction is applied;MapPresenterBase.TryGetDrawnNodePositiongives where the current node is drawn andMapPresenterBase.TryGetEdgePaththe route that reaches it.
IMapViewFactoryLifetime¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Optional lifetime contract used only for factories created and owned by a presenter.
IPlayerPawnPresenter¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Optional hook for drawing the traveller's own marker on the map.
Called once at the end of every presented pass. The current node is empty whenever the traveller is between nodes - before the first node is entered, and again after each one is completed - so an implementation needs an answer for "nowhere", usually hiding the pawn.
Methods
public void Present(StableId currentNodeId, MapLayout layout)-
Places the traveller's marker. -
currentNodeId— The current node, or an empty ID when the traveller is between nodes and the pawn should be hidden. -layout— Layout positions for the presented graph, before the style's flow direction is applied;MapPresenterBase.TryGetDrawnNodePositiongives where the current node is drawn.
IRouteMarkerPresenter¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Optional hook for marking the route already walked: footprints, a trail, a drawn line.
Called once at the end of every presented pass with the whole visited list, so an implementation must render the entire route each time rather than assuming only the last step is new.
Methods
public void Present(IReadOnlyList<StableId> visitedNodeIds, MapLayout layout)-
Draws the walked route. -
visitedNodeIds— Every node entered so far, in traversal order. An immutable snapshot: a fresh list arrives with the next state change. -layout— Layout positions for the presented graph, before the style's flow direction is applied, so they match the drawing only while that direction runs along the theme's axis unflipped. To place a marker where a node or a route is drawn, ask the presenter:MapPresenterBase.TryGetDrawnNodePositionandMapPresenterBase.TryGetEdgePath.
InputSystemSignalAdapter¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/InputSystemSignalAdapter.cs
Package-neutral bridge for Input System PlayerInput UnityEvents. Wire public signal methods from PlayerInput without adding a Waybranch compile-time package dependency.
Methods
public MapInputFrame Capture()-
Returns the currently held navigation/pointer state plus accumulated edge and delta signals, then clears submit, press, pan, and zoom for the next update. - Returns — A one-update value snapshot; held navigation, pointer position, and pinch state remain latched.
public void EndPinch()-
Ends the pinch so pointer presses activate nodes again. Nothing else clears the flag: without this call the map keeps ignoring taps.
public void SignalNavigate(Vector2 value)-
Latches directional intent across captures, matching a held Input System action; send zero when the action is canceled to stop navigation repeats. -
value— Usually a normalized stick, d-pad, or keyboard vector in the range -1 to 1 per axis. public void SignalPan(Vector2 delta)-
Accumulates pan movement until the next
Captureconsumes it. -delta— Incremental movement in the input action's units; repeated events in one update are summed. public void SignalPinch(float scaleDelta)-
Reports an in-progress pinch. It marks the pinch active and drops any pending pointer press, so pinching never selects a node; call
EndPinchwhen the gesture finishes. -scaleDelta— Pinch scale factor for this event: 1 leaves the zoom alone, 1.1 zooms in a tenth. The adapter accumulatesscaleDelta - 1into the frame's zoom delta. public void SignalPointer(Vector2 value)-
Records the pointer position in screen pixels and marks the frame as having a pointer. The position persists between frames; only the press is an edge. -
value— The current pointer position in screen pixels. public void SignalPointerPress()-
Marks a pointer press for the next captured frame. Ignored while a pinch is running, so a second finger cannot select a node.
public void SignalSubmit()-
Requests activation of the focused node on the next captured frame.
Captureclears it, so one call is one submit. public void SignalZoom(float delta)-
Accumulates wheel/axis zoom movement until the next
Captureconsumes it. -delta— Signed incremental zoom movement; positive values zoom in after controller sensitivity is applied.
LegacyMapInputSource¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapInput.cs
Input source for Unity's legacy Input Manager: axes for navigation, Return, Space
or the Submit button for activation, the mouse for pointing, middle-drag to pan
and the wheel to zoom, with touches folded in as tap, drag-pan and pinch-zoom.
MapInputController falls back to this when no other source is bound,
so the project needs the legacy input backend enabled and the "Horizontal",
"Vertical", "Submit", "Mouse X" and "Mouse Y" entries present in its input
settings. In a project whose Active Input Handling is the Input System only, legacy
Input does not exist: LegacyMapInputSource.Capture then returns an empty frame, and
MapInputController uses the Input System integration's source instead.
Methods
public MapInputFrame Capture()-
Reads one frame from
Input. While any finger is down the touch pointer replaces the mouse pointer and touch pan and zoom add to the mouse values; with no touches the gesture state is cleared, so a lifted finger cannot leak a delta into the next frame. - Returns — The current legacy-input snapshot; button presses are one-frame edges and touch deltas are measured from prior captured samples.
MapCameraBloom¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapCameraBloom.cs
Optional map bloom and vignette. Off by default and never required.
The shipped map look needs no post-processing: node glow, edge glow and state rings are drawn inside the SDF map surface shader. That is why Waybranch depends on no post-processing package, and why a project's existing volumes, renderer features and profiles cannot collide with it.
This component exists only for a project that wants a softer bloom across the whole map and is not already running its own post stack. It is a self-contained image effect with no package dependency.
Built-in render pipeline only. Under URP or HDRP, OnRenderImage is
never called, so rather than silently doing nothing this component detects
the active or configured pipeline, logs one explanatory warning, and
disables itself. Checking the configured default and quality override
matters during startup, before Unity creates its current pipeline instance.
Use that pipeline's own Bloom volume override instead.
To enable: add it to the camera that draws the map and enable the component. Nothing in the package adds it for you.
Properties
public bool IsSupportedPipeline-
True when this effect can run in the active or configured pipeline, which means the Built-in pipeline. A configured SRP is checked as well as the current instance because Unity can invoke
OnEnablebefore it creates the pipeline. Under an SRP the image-effect callback is never invoked, so the component turns itself off instead.
Fields
public const string ShaderName-
Name of the optional bloom shader.
public const string ShaderResourcePath-
Resources path of the optional bloom shader.
MapContentPoolAsset¶
:material-star: Start here
public sealed class MapContentPoolAsset : ScriptableObject, IMapNodeContentResolver, IMapNodeContentSelectionValidator
Waybranch.Runtime · 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 ResolverId-
Parsed resolver ID, or empty while the authored text is invalid.
public string StableIdText-
Raw stable resolver ID text.
Methods
public void Configure(string id, IEnumerable<MapContentPoolEntry> poolEntries)-
Replaces the identity and rows for code-created assets. -
id— Stable resolver identity written into each selection and save. -poolEntries— Weighted candidate rows copied in authored order; null clears the pool. public bool ContainsContent(StableId contentId)-
Checks row membership by stable content ID. -
contentId— Parsed customer content identity to find among non-null rows. - 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— Graph node, containing zone, and selection history used to filter and seed the choice. - Returns — The deterministic eligible selection, or a typed invalid, exhausted, or resolver failure.
MapContentPoolEntry¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapContentPoolAsset.cs
One weighted and filtered row in a MapContentPoolAsset.
Constructors
public MapContentPoolEntry( string contentId, int weight = 1, IEnumerable<MapNodeTypeAsset> nodeTypes = null, int minimumLayer = 0, int maximumLayer = -1, string zoneId = null, bool unique = false, int cooldownSelections = 0)-
One weighted candidate combines customer content identity with node, layer, zone, uniqueness, and cooldown filters. -
contentId— Customer content identity returned when this row is selected. -weight— Positive relative selection weight; zero or negative values are rejected by validation. -nodeTypes— Allowed node-type assets copied into the row; null or empty accepts every type. -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— Required zone identity text, or null or empty to accept every zone. -unique— Whether this content may be selected at most once during a run. -cooldownSelections— Number of intervening committed selections required before this row may repeat.
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¶
:material-star: Start here
Waybranch.Runtime · 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¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapContentPoolAsset.cs
Immutable input to an IMapNodeContentResolver.
Constructors
public MapContentResolutionRequest( MapGraph graph, MapNode node, StableId zoneId, IEnumerable<MapContentSelection> history)-
Copies the supplied history and pairs it with one exact graph node. -
graph— Non-null immutable graph that ownsnode. -node— Exact graph node for which content is being selected. -zoneId— Compiled zone containing the node layer, or an empty identity outside zones. -history— Prior committed selections copied in traversal order; null becomes empty.
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¶
:material-star: Start here
Waybranch.Runtime · 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( MapContentResolutionFailureKind failureKind, ValidationReport validation)-
A refusal result carries a non-success category and diagnostics while exposing no content selection. -
failureKind— Specific non-success category explaining why no eligible content was committed. -validation— Stable diagnostics describing the malformed request, resolver, exhaustion, or custom failure. - Returns — A result with a null selection and the supplied non-success failure category. public static MapContentResolutionResult Success(MapContentSelection selection, ValidationReport validation = null)-
Creates a successful resolver result around a non-null durable selection. -
selection— Resolved node, resolver, content, and history sequence to commit after traversal succeeds. -validation— Optional warnings or informational diagnostics produced during resolution. - Returns — A result with failure kindMapContentResolutionFailureKind.Noneand the supplied selection.
MapContentRoutingDiagnosticCodes¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapContentPoolAsset.cs
Stable diagnostics emitted by content routing.
Fields
public const string EntryDuplicate-
Two rows use the same content ID.
public const string EntryInvalid-
A resolver row is malformed.
public const string Exhausted-
No content is eligible for the request.
public const string RequestInvalid-
The request does not name a node from its graph.
public const string ResolverInvalid-
The resolver identity is invalid.
MapContentSelection¶
:material-star: Start here
Waybranch.Runtime · 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)-
Records which resolver assigned which game-content identity to one entered node. -
nodeId— Non-empty graph-node identity receiving the content. -resolverId— Non-empty identity of the resolver whose configuration made the choice. -contentId— Non-empty customer content identity to open for the node. -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— Selection whose four persisted value fields are compared, or null. - 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— Object to compare after treating it as a content selection. - Returns — only when all preconditions are satisfied; otherwise with no partial mutation. public override int GetHashCode()-
Returns a deterministic content-based hash code. - Returns — A deterministic integer composed from node, resolver, content, and sequence.
MapEdgeStyle¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceStateTable.cs
How one route reads in one visual state.
Constructors
public MapEdgeStyle(Color color, float widthScale, bool dashed, bool animated, bool hiddenUntilRevealed)-
Creates a resolved route style from explicit values; the colour keeps its alpha and the width is a multiplier, not a size. -
color— Route colour including its alpha. -widthScale— Width multiplier relative to the style's route width. -dashed— Whether the route is drawn as dashes. -animated— Whether the dashes flow, unless the presentation reduces motion. -hiddenUntilRevealed— Whether a presentation that hides locked routes omits it.
Properties
public bool Animated-
Whether the dashes flow along the route. Presentations that reduce motion keep them still.
public Color Color-
Route colour including its alpha.
public bool Dashed-
Whether the route is drawn as dashes rather than a solid stroke.
public bool HiddenUntilRevealed-
Whether a presentation that hides locked routes omits this route until it is revealed.
public float WidthScale-
Width multiplier relative to the style's route width.
MapEdgeViewData¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Everything an edge view needs to draw one route in one presented state: the graph edge, the sampled path along it, the colour to draw it in, and its fog state.
Immutable and passed by value. Both point lists are wrapped read-only on
construction - copied unless they are already a
ReadOnlyCollection{T} - so a caller may keep reusing its own
buffers without a bound view seeing them change underneath it.
Constructors
public MapEdgeViewData(MapEdge edge, IReadOnlyList<NormalizedMapPosition> points, Color color)-
Creates edge data from normalized points only. The point sequence is copied into a read-only collection so later caller mutations cannot alter the bound path. -
edge— The immutable graph edge represented by the view. -points— Source-to-target samples in normalized map space; null remains null. -color— The already resolved route color for this presentation pass. public MapEdgeViewData( MapEdge edge, IReadOnlyList<NormalizedMapPosition> points, IReadOnlyList<Vector2> presentationPoints, Color color, MapFogState fogState)-
The full form the presenter builds, with the path already converted to presentation units. -
edge— The immutable graph edge represented by the view. -points— Source-to-target samples in normalized map space; copied when non-null. -presentationPoints— The same samples after viewport conversion, in presenter units; copied when non-null. -color— The route color already selected from style/theme and progression state. -fogState— The visibility state the edge view must honor.
Properties
public Color Color-
The colour to draw the route in, already resolved for the role it plays this pass: walked, leading to a node the traveller may enter next, or dimmed by fog. It comes from the map's style, falling back to the theme's single edge colour when no style is assigned, so a view should draw with it rather than choose a colour of its own.
public MapEdge Edge-
The graph edge being drawn, carrying its id and the two nodes it joins.
public MapFogState FogState-
How visible the route is: the more hidden of its two endpoints' fog states, and
MapFogState.Hiddenwhen either endpoint has no state. A view that animates its own fog transitions is not deactivated for it, and so must end a transition to hidden invisible by itself. public IReadOnlyList<NormalizedMapPosition> Points-
The sampled path in normalized layout space, running from the edge's source endpoint to its target.
public IReadOnlyList<Vector2> PresentationPoints-
The same path in presentation units, one entry per
Pointsentry, or null when it was not supplied. A view given null convertsPointsitself.
MapEdgeVisualState¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
How one route reads to the player. The host derives it from node progression and from the destination the player is focusing, so every renderer and legend can style routes the same way.
| Value | Meaning |
|---|---|
Locked |
The route cannot be used now and has not been travelled; renderers may hide it until it is revealed. |
Available |
The traveller may use this route now, ahead or, when nothing was travelled on it, back. |
Traversed |
The route has been travelled and is not open ahead. |
Chosen |
The route lies on the way from the current node to the focused, reachable destination. |
MapExperienceCommandResult¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceHost.cs
Outcome of a presentation-independent command; refusals never change progression.
Properties
public string Message-
Reason for refusal, or empty text on success.
public bool Succeeded-
Whether the session committed the requested transition.
MapExperienceDemoControls¶
:material-star: Start here
Waybranch.Presentation.Canvas · Runtime/Presentation/Canvas/MapExperienceDemoControls.Hud.cs
Optional contextual HUD used by the experience examples. Copy is serialized for sample authors. By default it draws
the styled HUD: a header at the top left, a legend at the bottom left and a destination card with one primary action
at the bottom right, skinned from the map's own style. ConfigureCompactPresentation with false
selects the earlier full-width layout.
Properties
public MapExperienceHost Host-
Host controlled by this sample strip.
Methods
public void Configure(MapExperienceHost host)-
Assigns a host and rebuilds the controls when running. -
host— Host whose callbacks and state drive the demo controls. public void ConfigureCompactPresentation(bool enabled)-
Switches between the styled HUD (true, the default) and the earlier full-width layout (false); the host and its behaviour are not affected. -
enabled— True for the styled HUD; false for the full-width layout used before it existed. public void ConfigureOverlayMapViewport(bool enabled)-
Overlays the contextual HUD on a full-screen map viewport. -
enabled— Whether the map camera should retain the full normalized screen rectangle beneath the HUD.
MapExperienceEdgeSnapshot¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Immutable directed edge information passed to an experience renderer.
Constructors
public MapExperienceEdgeSnapshot(MapEdge edge, IReadOnlyList<Vector2> points, bool forwardAvailable, bool reverseAvailable, bool completed)-
Creates an immutable renderer-facing directed edge view. -
edge— Stable graph edge. -points— Presentation path points. -forwardAvailable— Whether traversal in the authored direction is allowed. -reverseAvailable— Whether reverse traversal is allowed by policy. -completed— Whether this edge has been traversed or completed. public MapExperienceEdgeSnapshot(MapEdge edge, IReadOnlyList<Vector2> points, bool forwardAvailable, bool reverseAvailable, bool completed, MapEdgeVisualState visualState)-
Creates an immutable renderer-facing directed edge view with an explicit visual state. -
edge— Stable graph edge. -points— Presentation path points. -forwardAvailable— Whether traversal in the authored direction is allowed. -reverseAvailable— Whether reverse traversal is allowed by policy. -completed— Whether this edge has been traversed or completed. -visualState— How the route reads to the player, including the focused destination's route.
Properties
public bool Available-
Compatibility convenience: true when traversal is available in either direction.
public bool Completed-
Whether this edge has already been traversed.
public MapEdge Edge-
Underlying stable graph edge.
public bool ForwardAvailable-
Whether authored-direction traversal is available.
public IReadOnlyList<Vector2> Points-
Immutable presentation path points.
public bool ReverseAvailable-
Whether reverse traversal is available.
public MapEdgeVisualState VisualState-
How this route reads to the player. Without an explicit value it follows
AvailableandCompleted.
MapExperienceHost¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceHost.cs
Owns a map session independently of its renderer, preserving legacy forward saves.
Properties
public MapExperienceVisitEvent ContentRequestedEvent-
Inspector content integration.
public long CurrentVisitToken-
Token for pending content; zero when no content awaits completion.
public MapStringUnityEvent FirstNodeCompletedEvent-
Inspector first-completion integration, useful for one-time rewards.
public bool IsExploration-
Whether this run permits bidirectional revisits.
public bool IsFinished-
Whether the active run has ended, including a restored finished save.
public bool IsReady-
Whether a validated session is active.
public MapExperienceVisitEvent NodeEnteredEvent-
Inspector arrival integration.
public MapExperiencePreset Preset-
Authoring source. Active options are detached from this asset.
public MapExperienceSnapshot Snapshot-
Latest snapshot, available even when no renderer is attached.
Events
public event Action<StableId, long> ContentRequested-
Requests game content once per required visit; use the supplied token to complete.
public event Action<string> Failed-
Diagnostic from configuration or a game-owned callback.
public event Action Finished-
Explicit exploration finish or terminal forward completion.
public event Action<StableId> FirstNodeCompleted-
First successful content completion of each node in this run.
public event Action<StableId, long> NodeEntered-
Arrival at a node, including visits that skip completed content.
public event Action<StableId, MapExperienceCommandResult> NodeRequested-
Raised after a request succeeds or is refused.
public event Action<MapExperienceSnapshot> Ready-
Raised when initialization or restoration provides a coherent map snapshot.
Methods
public void ApplyVisualPreset(MapExperiencePreset source)-
Applies temporary presentation and interaction options; active progression settings stay fixed. -
source— Created input source returned to the caller. public void AttachRenderer(IMapExperienceRenderer renderer)-
Replaces presentation while preserving the graph, policy and progression. -
renderer— Renderer associated with the accepted map selection. public bool AttachRenderer(MonoBehaviour component)-
Tests an Inspector component for the renderer contract and attaches it when compatible. -
component— Unity component that may implement the renderer contract. - Returns — True when the component implements the renderer contract and is attached; false for null or incompatible components. public bool AttachRenderer<T>(T component) where T : MonoBehaviour, IMapExperienceRenderer-
Attaches a component constrained to the renderer contract and reports whether it was accepted. -
component— Unity component that may implement the renderer contract. - Returns — True when a non-null renderer component is attached; false when the component is null. public bool CompleteCurrent(long expectedVisitId, MapDataPayload payload = null)-
Completes exactly the pending content request; stale callbacks cannot complete a later visit or run. -
expectedVisitId— Exact token expected for the active content visit. -payload— Canonical content result for the active visit; null uses the empty payload. - Returns — True when completion is accepted by the active traversal state. public bool CompleteCurrent()-
Completes the current visit synchronously; asynchronous game code must use its captured token. - Returns — True when completion is accepted by the active traversal state.
public void Configure(MapExperiencePreset value, MapTraversalController controller, IMapExperienceRenderer renderer)-
Assigns dependencies for the next initialization. Forward sessions reuse the optional legacy controller. -
controller— Legacy traversal controller used by the host. -renderer— Renderer associated with the accepted map selection. -value— Preset or value applied to this configuration. public void ConfigureCamera(Camera camera)-
Configures a scene renderer's camera without changing gameplay state. -
camera— Camera used for scene-space projection. public bool ConfigureFreeRect(Rect normalizedFreeRect)-
Asks a full-screen presentation to keep the map inside a normalized free area of the screen. -
normalizedFreeRect— Free area with a bottom-left origin. Presentations that clip to a viewport ignore it. - Returns — False for an invalid or empty rectangle. public void ConfigurePreset(MapExperiencePreset value)-
Assigns the authoring source for the next initialization. -
value— Preset or value applied to this configuration. public void ConfigureSimulationIsolation(bool isolated)-
Isolates an explicit-input simulation from the game's devices and shared UI hooks. -
isolated— Whether simulation input is isolated from scene input. public bool ConfigureViewport(Rect normalizedViewport)-
Reserves a normalized screen area for the map, retaining it across renderer changes. -
normalizedViewport— Viewport rectangle normalized to the range 0..1. - Returns — False for invalid or empty rectangles. Map generation and progression remain unchanged. public void ConfirmFocused()-
Submits the currently focused node through normal entry validation.
public bool FinishExploration()-
Finishes an exploration after pending content is resolved, even when neighbours remain. - Returns — True when the exploration is finished.
public bool Initialize()-
Compiles and generates a new session transactionally. A failure preserves the previous run. - Returns — True when the host initializes successfully.
public bool Load(string json)-
Restores matching graph and policy transactionally; a load invalidates old completion tokens. -
json— Serialized save payload to load or receive. - Returns — True when the serialized save matches the graph and restores successfully. public bool LoadExploration(string json)-
Restores an exploration without allowing a policy switch. -
json— Serialized save payload to load or receive. - Returns — True when the exploration save restores successfully. public void RefreshConditions()-
Re-evaluates conditions after inventory, objectives or other game state changes.
public MapExperienceCommandResult RequestNode(StableId nodeId)-
Requests entry after rechecking policy and conditions, returning a command result with transition and refusal details. -
nodeId— Stable identity of the node being entered, focused, or queried. - Returns — A command result whose success flag and message describe accepted traversal or the typed refusal. public bool Save(out string json)-
Serializes the active policy without storing presentation preferences or Unity object references. -
json— Serialized save payload to load or receive. - Returns — True when a canonical save is produced; the serialized JSON is written to the out parameter. public MapExplorationSerializationResult SaveExploration()-
Returns the versioned exploration serializer result, or null for a forward run. - Returns — The exploration serialization result, or null when the host uses legacy traversal.
public void SetConditions(IMapExperienceConditions conditions)-
Sets game-owned conditions and refreshes displayed availability. -
conditions— Condition provider used to gate entry and completion. public bool SetFocus(StableId nodeId)-
Focuses a visible node, without entering it. -
nodeId— Stable identity of the node being entered, focused, or queried. - Returns — True when the node is visible and becomes focused. public void SetInputSource(IMapInputSource input)-
Assigns an input adapter; null returns to the default input source. -
input— Input source polled by the host. public bool SetNodeOffset(StableId nodeId, Vector2 offset)-
Replaces a known node's presentation offset in normalized map units and immediately refreshes the snapshot. Invalid coordinates or an uninitialized host are refused; graph and save identity stay unchanged. -
nodeId— Stable identity of the node being entered, focused, or queried. -offset— Normalized visual offset applied to the node. - Returns — True when the offset is finite and applied to a known node. public void TickInput(MapInputFrame input)-
Processes shared mouse, touch and controller intent exactly once. -
input— Input source polled by the host.
MapExperienceInputGuard¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceInputGuard.cs
Optional ownership hooks used to prevent map input from crossing another UI. The game-owned callbacks
(PointerBlocked, NavigationBlocked, MapPointerSelected) return to their
defaults at every entry into Play mode, also when Domain Reload is disabled: assign them from Awake or
OnEnable (or a BeforeSceneLoad initializer or later) and remove them in OnDisable.
Fields
public static Action<MonoBehaviour> MapPointerSelected-
Transfers UI navigation focus after a pointer has selected a map node.
public static Func<MonoBehaviour, bool> NavigationBlocked-
Returns true when navigation focus belongs to another UI surface.
public static Func<Vector2, MonoBehaviour, bool> PointerBlocked-
Returns true when a pointer event belongs to another UI surface.
Methods
public static bool IsNavigationBlocked(MonoBehaviour selectedObject)-
Consults game and optional UI ownership callbacks before allowing navigation input. -
selectedObject— Object currently owning navigation focus. - Returns — True when navigation is owned by another UI surface. public static bool IsPointerBlocked(Vector2 screenPosition, MonoBehaviour renderer)-
Consults game and optional UI ownership callbacks before allowing pointer input. -
renderer— Renderer associated with the accepted map selection. -screenPosition— Screen-space position in pixels. - Returns — True when the pointer is owned by another UI surface. public static void NotifyMapPointerSelected(MonoBehaviour renderer)-
Notifies both the UI adapter and the game after an accepted map pointer selection. -
renderer— Renderer associated with the accepted map selection. public static void RegisterUiOwnership(Func<Vector2, MonoBehaviour, bool> pointerBlocked, Func<MonoBehaviour, bool> navigationBlocked, Action<MonoBehaviour> mapPointerSelected)-
Installs the optional Unity UI adapter without replacing game-owned blocking callbacks. -
mapPointerSelected— Callback invoked after a map pointer selection is accepted. -navigationBlocked— Callback that reports whether navigation belongs to another UI surface. -pointerBlocked— Callback that reports whether a pointer belongs to another UI surface. public static void Reset()-
Clears game-owned callbacks while retaining any installed Unity UI adapter. Waybranch also calls it at every entry into Play mode, so a callback never survives from one Play session to the next when Domain Reload is disabled.
MapExperienceNodeSnapshot¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Immutable node information passed to an experience renderer.
Constructors
public MapExperienceNodeSnapshot(StableId id, StableId typeId, Vector2 position, MapNodeVisualState visualState, MapFogState fogState, bool available, bool current, bool focused, string label, string iconKey, float elevation = 0f)-
Creates an immutable renderer-facing node view. -
id— Stable node identifier. -typeId— Stable node-type identifier. -position— Normalized presentation position. -visualState— Current visual state. -fogState— Current visibility state. -available— Whether entry is currently allowed. -current— Whether this is the active location. -focused— Whether this node has focus. -label— Display label. -iconKey— Renderer-specific icon key. -elevation— Optional world presentation elevation.
Properties
public bool Available-
Whether entry is currently permitted.
public bool Current-
Whether this node is the active location.
public float Elevation-
Optional world presentation elevation.
public bool Focused-
Whether this node owns focus.
public MapFogState FogState-
Current fog or visibility state.
public string IconKey-
Renderer-specific icon key.
public StableId Id-
Stable node identifier.
public string Label-
Display label supplied to the renderer.
public Vector2 Position-
Normalized presentation position.
public StableId TypeId-
Stable node-type identifier.
public MapNodeVisualState VisualState-
Current visual state.
MapExperienceRendererRegistry¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceRendererRegistry.cs
Optional assembly-neutral renderer registry. Presentation assemblies register factories at load time; the runtime host never references those assemblies directly.
Methods
public static void Register(MapExperienceBackend backend, Func<GameObject, IMapExperienceRenderer> factory)-
Associates a backend with a factory that creates its renderer. -
backend— Backend key whose renderer factory is being registered. -factory— Factory that creates a renderer under an owner GameObject. public static bool TryCreate(MapExperienceBackend backend, GameObject owner, out IMapExperienceRenderer renderer)-
Uses the registered backend factory to create a renderer for the owner. -
backend— Backend key to resolve. -owner— GameObject that owns the created renderer. -renderer— Created renderer, or null when no factory succeeds. - Returns — True when a registered factory returns a renderer; false when no factory is registered or creation returns null. public static void Unregister(MapExperienceBackend backend)-
Removes the factory associated with the backend, if one is registered. -
backend— Backend key whose factory is removed.
MapExperienceSnapshot¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Coherent immutable graph and visual state supplied to a renderer.
Constructors
public MapExperienceSnapshot(MapGraph graph, IEnumerable<MapExperienceNodeSnapshot> nodes, IEnumerable<MapExperienceEdgeSnapshot> edges, StableId focusedNodeId, StableId currentNodeId, long revision, string styleId, MapExperienceRuntimeOptions options = null, MapRuntimeContent content = null, MapExperienceTraversalStamp traversal = default(MapExperienceTraversalStamp))-
Creates an immutable presentation snapshot from graph data, visible elements, focus, revision, content, options, and traversal metadata. -
graph— Compiled graph represented by the snapshot. -nodes— Node views. -edges— Directed edge views. -focusedNodeId— Focused node ID. -currentNodeId— Current location ID. -revision— Session revision. -styleId— Stable style identifier. -options— Detached presentation options. -content— Runtime content metadata. -traversal— Latest traversal stamp.
Properties
public MapRuntimeContent Content-
Runtime content metadata, when supplied.
public StableId CurrentNodeId-
Current location ID.
public IReadOnlyList<MapExperienceEdgeSnapshot> Edges-
Immutable edge views.
public StableId FocusedNodeId-
Currently focused node ID.
public MapGraph Graph-
Compiled graph represented by this snapshot.
public MapExperienceTraversalStamp LastTraversal-
Latest committed traversal information.
public IReadOnlyList<MapExperienceNodeSnapshot> Nodes-
Immutable node views.
public MapExperienceRuntimeOptions Options-
Detached presentation options.
public long Revision-
Session revision represented by the snapshot.
public string StyleId-
Stable style identifier.
MapExperienceStateTable¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceStateTable.cs
The single source for how node types and routes read in each state. The World3D renderer styles its markers and ribbons with these methods, and a legend or HUD can call the same methods so what it shows is by construction what the map shows.
Methods
public static Color NodeColor(MapExperienceSnapshot snapshot, StableId nodeTypeId, MapNodeVisualState state)-
The tint of a node type in a visual state. -
snapshot— Snapshot supplying node-type colours, the accent colour and the style. May be null. -nodeTypeId— Stable node-type identifier. -state— Visual state whose tint is required. - Returns — The node type's own colour for the state, or the style palette fallback when the type is unknown. A known type whose Available colour is still the white of a new node type asset keeps the colours of a new node type where they read 3:1 on the style; a state that would not is fixed (MapStyleRuntime.NodeStateColor): Available takes the available route colour or the accent, and Current, Visited and Completed keep their hue, darkened or lightened until they read. public static MapEdgeStyle ResolveEdge(CompiledMapStyle style, MapEdgeVisualState state)-
How a route reads in a visual state. -
style— Compiled style supplying the palette; null selects the built-in default style. -state— Route state to resolve. - Returns — Colour, width scale, dash and reveal rules. The chosen route is dashed and animated, available routes are solid, travelled routes recede, and locked routes may be hidden. public static MapMarkerStyle ResolveMarker(MapExperienceSnapshot snapshot, StableId nodeTypeId, MapNodeVisualState state)-
Resolves a marker for a node type in a visual state, as a legend entry would show it. -
snapshot— Snapshot supplying the node-type colours and the style. May be null for built-in fallbacks. -nodeTypeId— Stable node-type identifier. -state— Visual state to show. - Returns — Colour, symbol and labels for the type in that state. public static MapMarkerStyle ResolveMarker(MapExperienceSnapshot snapshot, MapExperienceNodeSnapshot node)-
Resolves the marker the world draws for one node snapshot. -
snapshot— Snapshot that supplies content and style. -node— Node whose current state is shown. - Returns — Colour, symbol and labels for that node. public static string StateLabel(MapNodeVisualState state)-
Short English label of a node state. -
state— Visual state to describe. - Returns — A one- or two-word label; empty for unknown values. public static string StateLabel(MapEdgeVisualState state)-
Short English label of a route state. -
state— Route state to describe. - Returns — A one- or two-word label. public static MapMarkerSymbol SymbolFor(MapNodeVisualState state)-
The symbol family a node state uses. -
state— Visual state to map. - Returns — Current, Available, Locked, or Visited (also used for completed); None for hidden or unknown states.
MapExperienceTraversalStamp¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceContracts.cs
Immutable traversal metadata identifying the current route, node, and completion state.
Constructors
public MapExperienceTraversalStamp(string visitId, StableId edgeId, StableId sourceId, StableId targetId, bool reversed)-
Captures immutable route, edge, endpoint, visit, and reversal metadata for one traversal stamp. -
visitId— Stable visit identity. -edgeId— Traversed edge ID. -sourceId— Origin node ID. -targetId— Destination node ID. -reversed— Whether movement used the reverse direction.
Properties
public StableId EdgeId-
Traversed edge ID.
public bool Reversed-
Whether movement used the reverse direction.
public StableId SourceId-
Origin node ID.
public StableId TargetId-
Destination node ID.
public string VisitId-
Stable visit identity.
MapExperienceVisitEvent¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceHost.cs
Inspector callback carrying node ID and an exact, runtime-only completion token.
MapFogSettings¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeState.cs
How far ahead of the traveller the map is revealed.
Fog is derived, never stored, so changing these values re-reveals an existing save correctly instead of needing a migration.
Properties
public static MapFogSettings Default-
The classic behaviour: one step of look-ahead, forwards only.
public static MapFogSettings Revealed-
Every node visible.
Fields
public bool RevealAll-
Reveal every node regardless of progress.
public int RevealDepth-
How many edges ahead of a reached node stay visible, as dimmed "locked" nodes. 0 shows only what the traveller has reached and what is immediately available. 1 also shows the next choices, which is the classic run-based-map behaviour and the default. 2 shows the choice after that, and so on. A value at or above the layer count effectively reveals the whole map.
public bool RevealIncoming-
Also reveal nodes that lead INTO a reached node, not just out of it. Useful for maps a traveller can move back through.
Methods
public MapFogSettings Sanitized()-
Clamps the settings into their supported range. - Returns — A copy with negative reveal depth raised to zero and the two flags unchanged.
MapFogState¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeState.cs
How visible a node is, derived from its MapNodeVisualState: a hidden
node reports MapFogState.Hidden, a locked one
MapFogState.Dimmed, and anything the traveller has reached or can reach
MapFogState.Visible. The built-in presenters give a route the more
hidden of its two endpoints' states.
| Value | Meaning |
|---|---|
Hidden |
Not shown. |
Dimmed |
Shown, but held back; the built-in views draw it at reduced opacity. |
Visible |
Shown at full strength. |
MapHostDiagnosticCodes¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/WaybranchMapHost.cs
Stable diagnostic identifiers emitted by WaybranchMapHost.
Fields
public const string AuthoringInvalid-
Emitted when authoring Invalid; callers can match this stable code ordinally without parsing its human-readable message.
public const string ConfigurationMissing-
Emitted when configuration Missing; callers can match this stable code ordinally without parsing its human-readable message.
public const string ContentFailed-
Emitted when content Failed; callers can match this stable code ordinally without parsing its human-readable message.
public const string ContentStateInvalid-
Emitted when content State Invalid; callers can match this stable code ordinally without parsing its human-readable message.
public const string ControllerRejected-
Emitted when controller Rejected; callers can match this stable code ordinally without parsing its human-readable message.
public const string GenerationFailed-
Emitted when generation Failed; callers can match this stable code ordinally without parsing its human-readable message.
public const string IdentifierInvalid-
Emitted when identifier Invalid; callers can match this stable code ordinally without parsing its human-readable message.
public const string OperationInProgress-
Emitted when operation In Progress; callers can match this stable code ordinally without parsing its human-readable message.
public const string SaveFailed-
Emitted when save Failed; callers can match this stable code ordinally without parsing its human-readable message.
public const string SaveIdentityInvalid-
Emitted when save Identity Invalid; callers can match this stable code ordinally without parsing its human-readable message.
public const string SaveNotFound-
Emitted when save Not Found; callers can match this stable code ordinally without parsing its human-readable message.
public const string TransitionRejected-
Emitted when transition Rejected; callers can match this stable code ordinally without parsing its human-readable message.
MapHostFailureKind¶
:material-star: Start here
Waybranch.Runtime · 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¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/WaybranchMapHost.cs
Each value names the host command represented by a typed operation result.
| 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¶
:material-star: Start here
Waybranch.Runtime · 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¶
:material-star: Start here
Waybranch.Runtime · 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¶
:material-star: Start here
Waybranch.Runtime · 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. |
MapHostStarterPanel¶
:material-star: Start here
Waybranch.Presentation.Canvas · Runtime/Presentation/Canvas/MapHostStarterPanel.cs
Small removable uGUI control panel created by the Setup Wizard's one-click starter flow.
It proves that the generated host can start, traverse, complete, save, and load before a
project has written its own campaign UI. Replace or remove it when integrating real content.
Its text is set in the package's default font (MapDefaultFont), as the names on the map.
Properties
public WaybranchMapHost Host-
The host driven by this starter panel.
public string Status-
The same operator feedback currently shown by the status label.
Methods
public void CompleteCurrent()-
Completes the current node with a neutral starter payload. A real integration should call
WaybranchMapHost.CompleteCurrent(MapDataPayload)with its result. public void Configure(WaybranchMapHost mapHost)-
Assigns the host and creates the neutral built-in panel if it is not present. -
mapHost— Host that receives button commands and supplies readiness, content, failure, and state notifications. public void Save()-
Persists Waybranch value atomically; an expected storage failure is reported without replacing the last valid save.
public void StartNew()-
Starts a new run using the host's configured seed policy.
public void TryLoad()-
Attempts to load without throwing for expected invalid input; failure leaves output parameters at documented defaults.
MapInputController¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapInputController.cs
The component that turns input frames into map interaction: it moves focus between
nodes, submits the focused or pressed node to a MapTraversalController,
and pans and zooms the content transform inside the theme's zoom limits while
keeping the focused node in view. Frames come from any IMapInputSource
and presses are resolved by any IMapNodeHitTester, so a project can
change input stack or presentation style without touching the map. It stays inert
until a traversal controller is initialized and a layout is available: ticks before
that are dropped, not queued.
A bound presenter's style may mirror the map or turn it a quarter on screen (its flow direction), so a direction pressed on screen is turned into the layout direction that is drawn that way before the navigation model ranks nodes, and the focused node is kept in view where it is drawn rather than at its layout position.
Properties
public MapLayout CurrentLayout-
The layout spatial navigation and framing currently work from, or null before one is set. With a presenter bound it follows that presenter's layout; otherwise it is whatever
SetLayoutorConfigurelast supplied. Input frames are dropped while it is null. public DefaultMapNodeHitTester DefaultHitTester-
The serialized hit tester, kept in a field so the binding survives a domain reload. It is not necessarily the tester in use: one passed to
Configuretakes precedence without being stored here, whileBindPresenterdoes store one it is given when it happens to be aDefaultMapNodeHitTester. public Camera EventCamera-
The camera screen positions are interpreted through for zoom anchoring and world-space viewport maths, or null to let the controller resolve one itself:
Camera.main, else the first active camera in a stable order. A camera resolved that way is cached and is looked for again only once it goes inactive or the scene's camera count changes, so an empty scene does not re-scan every frame. public InputSystemSignalAdapter InputSignals-
The serialized Input System adapter, which acts as the fallback source: when no source has been bound the update loop captures from this, and when this is null too it falls back to the default source:
LegacyMapInputSourcein a project that has the Input Manager enabled, or the device source of the Input System integration in a project that uses the Input System only. public MapNavigationModel Navigation-
The focus model this controller drives. Read it to learn which node is focused, or move focus yourself between ticks. Focus is presentation state: moving it neither enters a node nor touches progression, and a change made directly on the model is not announced through
FocusChangeduntil the next tick publishes it. public Vector2 Pan-
Current pan offset, already clamped so the map cannot be dragged out of reach. A Canvas map measures it in the content parent's local units; a world map in hundredths of them, matching the anchored-position and world scales the component writes.
public MapPresenterBase Presenter-
The presenter supplying the layout and receiving focus updates, or null when the controller was pointed at a layout directly. Only a bound presenter keeps the layout current, and only while the component is enabled -- the subscription is dropped on disable and taken again on enable.
public MapTraversalController TraversalController-
The traversal controller node selections are submitted to, or null before one is bound. The component stays inert until this is set and initialized: frames arriving before then are dropped rather than queued.
public Transform ViewportContent-
The transform pan and zoom are written to, or null when the map is not to be moved at all. A
RectTransformreceives the pan as its anchored position; any other transform receives it as a local position in hundredths of the same units, which is whyPanis measured differently for the two presentation styles. public float Zoom-
Current zoom multiplier written to the content transform's scale. It starts at 1 and every tick clamps it into the theme's minimum and maximum zoom.
Events
public event Action<StableId> FocusChanged-
Raised when the focused node changes, including when focus is lost - the argument is then an empty
StableId. The presenter has already been told about the new focus by the time handlers run.
Methods
public void BindCamera(Camera value)-
Sets and immediately caches the camera used for pointer-to-world conversion and pointer-anchored zoom. -
value— The explicit camera, or null to clear the cache and enable deterministic scene resolution. public void BindDefaultHitTester(DefaultMapNodeHitTester hitTester)-
Makes this tester resolve pointer presses and stores it in the serialized field, so the binding survives a domain reload. It replaces any tester passed to
ConfigureorBindPresenter. -hitTester— The serialized shipped tester to use for subsequent pointer presses; null disables this fallback. public void BindInputSignals(InputSystemSignalAdapter signals)-
Makes this signal adapter the input source and stores it in the serialized field. The directional hold-repeat state is reset, so a direction held on the previous source cannot repeat straight into the new one. -
signals— The PlayerInput-compatible signal accumulator to capture each update, or null to restore the default source. public void BindPresenter( MapTraversalController controller, MapPresenterBase presenter, Transform contentTransform = null, IMapInputSource source = null, IMapNodeHitTester hitTester = null)-
Binds the controller to a presenter and follows it: the presenter's current layout is adopted, later layout changes are tracked, and focus is published back to the presenter. The layout subscription is released when the component is disabled and taken again when it is enabled, so a presenter swapped while disabled needs re-binding. -
presenter— Supplies the layout and receives focus updates. -contentTransform— The transform whose local position and scale receive pan/zoom, or null to track state without moving content. -source— Where frames come from. Null leaves the component to fall back to its serialized signal adapter, or to the default source, on the next update. -hitTester— Resolves pointer presses to nodes. Null falls back to the serializedDefaultMapNodeHitTester, then to one found among the children. -controller— The initialized traversal controller that supplies availability and receives node requests. public void Configure( MapTraversalController controller, MapLayout layout, IMapInputSource source, IMapNodeHitTester hitTester, Transform contentTransform = null)-
Wires the controller to a layout directly, with no presenter: it drops any presenter binding and its layout-change subscription, recovers focus from the traversal state, and applies the current pan and zoom to the content transform. Prefer
BindPresenterwhen aMapPresenterBaseowns the layout, because only that path follows later layout changes. -layout— The immutable graph layout used for spatial navigation and focused-node zoom anchoring; null leaves input inert. -source— Where frames come from. Null leaves the component to fall back to its serialized signal adapter, or to the default source, on the next update. -hitTester— Resolves pointer presses to nodes. Null leaves pointer selection off until a tester is bound or the component is re-enabled. -contentTransform— The transform whose local position and scale receive pan/zoom, or null to track state without moving content. -controller— The initialized traversal controller that supplies availability and receives node requests. public void ConfigureNavigationRepeat(float initialDelaySeconds, float intervalSeconds)-
Replaces the configure Navigation Repeat settings used by future operations; existing immutable graphs and saves are not rewritten. -
initialDelaySeconds— Seconds a direction is held before it starts repeating. Negative values are clamped to zero. -intervalSeconds— Seconds between repeats once repeating starts. Values below 0.01 are raised to 0.01. public void OnAfterDeserialize()-
Unity serialization callback. It rebuilds the cached source and hit tester from the serialized fields and forgets any automatically resolved camera, so a domain reload cannot leave the controller pointing at dead references. Unity calls it; you should not.
public void OnBeforeSerialize()-
Unity serialization callback. It does nothing: the controller has no runtime state worth flattening.
public void SetLayout(MapLayout layout)-
Swaps the layout that spatial navigation and framing work from, then recovers focus, brings it into view, and re-applies the transform. A null layout clears focus and leaves the controller inert until a layout is set again. -
layout— The replacement immutable node layout, or null to clear navigation focus and suspend input handling. public void SetSource(IMapInputSource source)-
Replaces the input source, cancels the current directional hold, and re-checks focus. Passing null makes the next update fall back to the serialized signal adapter, or to the default source when there is none. -
source— The source captured once per update, or null to use the serialized signal adapter or the default source. public void Tick(MapInputFrame frame)-
Applies one input frame using an automatically resolved zoom anchor and
Time.unscaledDeltaTimefor directional repeat timing. It is a no-op until both traversal and layout are ready. -frame— The one-update input snapshot; submitting the same value twice repeats its edge actions and deltas. public void Tick(MapInputFrame frame, Vector2 anchorLocal)-
Applies one frame with a caller-selected local-space zoom anchor and the engine's unscaled frame delta. -
anchorLocal— The point inViewportContentlocal units that must remain visually fixed while zoom changes. -frame— The one-update input snapshot; submitting the same value twice repeats its edge actions and deltas. public void Tick(MapInputFrame frame, Vector2 anchorLocal, float deltaSeconds)-
Applies one frame with explicit anchor and elapsed time, enabling deterministic tests or a custom update loop without reading Unity's clock. -
anchorLocal— The point inViewportContentlocal units that must remain visually fixed while zoom changes. -deltaSeconds— Time since the previous tick. It advances the directional hold-repeat clock only; pan and zoom come from the frame's deltas, so the step never scales movement. -frame— The one-update input snapshot; submitting the same value twice repeats its edge actions and deltas.
MapInputFrame¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapInput.cs
One update's worth of map input, reduced to the six signals the controller acts on: a directional axis, a submit request, a pointer, pan and zoom deltas, and a pinch flag. Everything here describes that update alone, so a frame is meant to be applied once - feeding the same frame twice pans, zooms, and submits twice.
Constructors
public MapInputFrame( Vector2 navigation, bool submit, Vector2 pointerPosition, bool pointerPressed, Vector2 panDelta, float zoomDelta, bool pinchActive)-
Captures one update of navigation, pointer, pan, zoom, and pinch input. This convenience overload infers pointer availability from pointer/gesture activity. -
navigation— Directional intent; seeNavigationfor the threshold applied. -pointerPosition— Pointer position in screen pixels. -panDelta— Pan movement for this frame, not an absolute offset. -zoomDelta— Zoom change for this frame, not an absolute zoom. -submit— True only on the update that activates the focused node. -pointerPressed— True only on the update that should hit-test and activate atpointerPosition. -pinchActive— True while a multi-touch pinch is active, suppressing pointer activation. public MapInputFrame( Vector2 navigation, bool submit, Vector2 pointerPosition, bool pointerPressed, Vector2 panDelta, float zoomDelta, bool pinchActive, bool hasPointerPosition)-
Captures one update of map input with an explicit pointer-presence flag. The value object performs no clamping; the controller applies its own thresholds and sensitivity settings when the frame is consumed. -
navigation— Directional intent; seeNavigationfor the threshold applied. -pointerPosition— Pointer position in screen pixels. -panDelta— Pan movement for this frame, not an absolute offset. -zoomDelta— Zoom change for this frame, not an absolute zoom. -hasPointerPosition— False when no pointer exists, which makes the controller anchor zoom on the focused node instead. -submit— True only on the update that activates the focused node. -pointerPressed— True only on the update that should hit-test and activate atpointerPosition. -pinchActive— True while a multi-touch pinch is active, suppressing pointer activation.
Properties
public bool HasPointerPosition-
Whether
PointerPositionis usable this frame. It decides the zoom anchor: with a pointer the map zooms around it, without one it zooms around the focused node. public Vector2 Navigation-
Directional intent, normally -1..1 per axis. The controller follows the dominant axis and ignores both axes below 0.5, so a stick, a d-pad, and key axes all behave the same.
public Vector2 PanDelta-
Pan movement for this frame in the source's own units; the controller scales it by its pan sensitivity and adds it to
MapInputController.Pan. public bool PinchActive-
True while a two-finger pinch is in progress. The controller suppresses pointer activation on those frames, so a pinch cannot select a node.
public Vector2 PointerPosition-
Pointer position in screen pixels, meaningful only while
HasPointerPositionis set. public bool PointerPressed-
Set for the one frame the source reports a press or tap. The controller hit-tests at
PointerPositionand submits the node it finds. public bool Submit-
Set for the one frame activation was requested; the controller then submits the focused node. Ignored when a pointer press already activated a node in the same frame, so a tap never selects twice.
public float ZoomDelta-
Zoom change for this frame, added to the current zoom after the controller's zoom sensitivity. Wheel sources report the wheel delta, pinch sources the scale factor minus one.
MapMarkerStyle¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceStateTable.cs
How one node type reads in one visual state: tint, state symbol and wording.
Constructors
public MapMarkerStyle(Color color, MapMarkerSymbol symbol, string typeLabel, string stateLabel)-
Creates a resolved marker style from explicit values; null labels become empty strings. -
color— Tint applied to the marker. -symbol— State symbol drawn on or beside the marker. -typeLabel— Display label of the node type. -stateLabel— Short English label of the state.
Properties
public Color Color-
Tint applied to the marker.
public string Label-
Type and state in one phrase, for example "Harbor (Available)".
public string StateLabel-
Short English label of the state, such as "Available".
public MapMarkerSymbol Symbol-
State symbol drawn on or beside the marker.
public string TypeLabel-
Display label of the node type; empty when the type is unknown.
MapMarkerSymbol¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapExperienceStateTable.cs
Silhouette family a marker uses to show its state without relying on colour alone.
| Value | Meaning |
|---|---|
None |
No state symbol, used for nodes that are not drawn. |
Current |
Upward triangle: the node the traveller is on. |
Available |
Diamond: the traveller may enter this node now. |
Locked |
Cross: the node cannot be entered yet. |
Visited |
Square: the node was entered or completed earlier. |
MapMeshRouteSurface¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapMeshRouteSurface.cs
Bounded, presentation-only height sampler for authored route surfaces. Samples are expressed in the configured root's local XZ space.
Properties
public int UnreadableSurfaceCount-
Number of configured MeshFilters skipped because their mesh is not readable.
Methods
public void Configure(Transform root, MeshFilter[] surfaces)-
Configures and rebuilds the sampler from authored mesh filters. -
root— Transform whose local space the sampled heights and positions are expressed in; null uses this component's own transform. -surfaces— Mesh filters whose upward-facing triangles can be walked; the array is copied and null means no surface. public bool TryGetHeight(Vector2 localXZ, out float localY)-
Returns the highest valid upward-facing triangle height at local XZ. -
localXZ— Position on the ground plane in the presentation root's local space, with the second component along Z. -localY— Height of the highest walkable triangle above that position; zero when none is found. - Returns — True when a finite position lies over a walkable triangle and a height was written; false otherwise.
MapNavigationDirection¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapNavigation.cs
A directional focus step, named in normalized layout space: Up is increasing Y and Right is increasing X, whatever the presenter later does with those axes on screen.
| Value | Meaning |
|---|---|
Left |
Searches toward decreasing normalized X. |
Right |
Searches toward increasing normalized X. |
Up |
Searches toward increasing normalized Y. |
Down |
Searches toward decreasing normalized Y. |
MapNavigationModel¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapNavigation.cs
Keyboard and gamepad focus for a map. It holds nothing but the focused node and derives every choice from the progression, layout, and runtime state handed in, so the same inputs over the same map always land on the same node.
Focus is presentation state: moving it neither enters a node nor changes progression, and a node hidden by fog is never chosen.
Properties
public StableId FocusedNodeId-
The focused node, or an empty id when nothing is focused.
Methods
public void ClearFocus()-
Drops focus, leaving
FocusedNodeIdempty. public bool Move(MapNavigationDirection direction, MapLayout layout, MapRuntimeStateSnapshot runtimeState)-
Steps focus to the nearest visible node in one direction. A node counts as a candidate only when that direction is the dominant axis of the offset to it; the nearest by squared distance then wins, ties break by the offset across the direction, and remaining ties by the lower node id, which is what makes the step deterministic. Distances come from the layout, not from where the presenter draws the nodes. -
direction— Normalized-space half-plane in which a candidate must lie. -layout— Deterministic node positions used to rank directional candidates. -runtimeState— Fog snapshot used to exclude hidden nodes from navigation. - Returns — True when focus moved. With nothing focused yet, no focused position in the layout, or no qualifying candidate, focus is left untouched and this returns false. public StableId RecoverFocus(MapProgressionState progression, MapLayout layout, MapRuntimeStateSnapshot runtimeState)-
Re-picks focus after the map changes, keeping the focused node when it is still visible. Otherwise it prefers the node being played, then the first visible available node, then the first visible visited node, then any visible node, and clears focus if the map has nothing visible at all. -
runtimeState— Per-node fog state; a node it does not contain cannot be focused. -progression— Current, available, and visited node order used by the recovery preference. -layout— Layout paired with the progression; required for a consistent navigation model. - Returns — The focused node after recovery, or an empty id when nothing could be focused. public bool TrySetFocus(StableId nodeId, MapRuntimeStateSnapshot runtimeState)-
Focuses a node directly, as a pointer tap does. Nothing changes when the node is unknown to
runtimeStateor hidden by fog, so a tap on a hidden node cannot take focus away from a visible one. -nodeId— Identity to focus when it exists in the snapshot and is not hidden. -runtimeState— Per-node fog snapshot that determines whether the target can receive focus. - Returns — True when focus moved to the node.
MapNodeRuntimeState¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeState.cs
One node's derived display state: the visual state a presenter styles it with, plus
the fog state that decides whether it can be seen at all. An immutable value read
out of a MapRuntimeStateSnapshot; it is never updated in place, so a
copy keeps reporting the revision it was taken from.
Constructors
public MapNodeRuntimeState(StableId nodeId, MapNodeVisualState visualState, MapFogState fogState)-
Pairs a node with the visual and fog state derived for it. -
nodeId— Graph-node identity under which this derived state is indexed. -visualState— Highest-precedence progression treatment selected for the node. -fogState— Visibility tier derived from the visual state and discovery settings.
Properties
public MapFogState FogState-
How visible the node is, derived from
VisualStateand never independent of it: hidden nodes reportMapFogState.Hidden, locked onesMapFogState.Dimmed, and everything elseMapFogState.Visible. It is the field to test before drawing or hit-testing, since a concealed node is present in the snapshot rather than absent from it. public StableId NodeId-
The node these two states were derived for; also the key it is stored and sorted under.
public MapNodeVisualState VisualState-
How the node reads to the player, and what a presenter styles it as. A node can satisfy several conditions at once, so this is already the winner of a fixed precedence and not a set to interpret further.
Methods
public int CompareTo(MapNodeRuntimeState other)-
Orders by
NodeIdalone, ignoring both states. This is what gives a snapshot's node list an order that depends on the graph and not on progress. -other— Node runtime state whose identity is compared; its visual and fog fields are ignored. - Returns — A negative, zero, or positive value from ordinal stable-ID ordering.
MapNodeStateTint¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapNodeStateTint.cs
Marks the part of an authored node prefab that shows the node's state, for example the rim of a table piece's base. When a prefab has any marked renderer, the World3D presentation tints only those renderers with the state colour of the node type and leaves every other material as authored; a legend resolves the same colour for its state samples.
MapNodeViewData¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
Everything a node view needs to draw one node in one presented state: the graph node, where it sits, its compiled type, and its visual and fog state.
Immutable and passed by value, so a view may keep a copy but must not expect
that copy to change. The presenter rebuilds the data and calls
IMapNodeView.Bind again when the node's presented state changes,
which is why a view never has to poll the graph or the traversal state.
Constructors
public MapNodeViewData( MapNode node, NormalizedMapPosition position, CompiledMapNodeType nodeType, MapNodeVisualState visualState, MapFogState fogState)-
Creates view data in normalized layout space for a custom view that performs its own framing. The constructor does not validate or clone the referenced graph/type objects. -
node— The immutable graph node represented by the view. -position— The node's normalized layout position, normally in the zero-to-one map frame. -nodeType— Compiled presentation metadata; null produces empty label and tooltip fallbacks. -visualState— The progression-derived visual role to draw. -fogState— The visibility state the view must honor. public MapNodeViewData( MapNode node, NormalizedMapPosition position, CompiledMapNodeType nodeType, MapNodeVisualState visualState, MapFogState fogState, Vector2 presentationPosition, float nodeSize, bool hasPresentationPosition, string displayLabel, string tooltip)-
The full form the presenter builds: placement and size are already resolved into presentation units, and the label and tooltip have already been through the localization adapter. -
presentationPosition— Where to draw the node, in presentation units. -nodeSize— Unstyled node size, in the same units aspresentationPosition. -hasPresentationPosition— False to tell the view thatpresentationPositionandnodeSizeare not authoritative and it should place and size the node itself. -displayLabel— Localized label; null is stored as an empty string, which asks the view to draw no label. -tooltip— Localized tooltip; null is stored as an empty string. -node— The immutable graph node represented by the view. -position— The original normalized layout position retained for custom view logic. -nodeType— Compiled type metadata used for art, cues, and authored fallback text. -visualState— The progression-derived visual role at bind time. -fogState— The derived visibility state at bind time.
Properties
public string DisplayLabel-
Node label, already localized. Never null; empty asks the view to draw no label.
public MapFogState FogState-
How visible the node is, derived from
VisualState. The presenter binds and activates a node view even when this isMapFogState.Hidden, so drawing nothing in that state is the view's own responsibility. public bool HasPresentationPosition-
False when this data was built without presentation metrics, in which case the view must place and size the node from
Positionitself instead of trustingPresentationPosition. public MapNode Node-
The graph node being drawn, carrying its id, its node-type reference, and its authored payload.
public float NodeSize-
Node size in the same presentation units as
PresentationPosition. This is the unstyled base size: a style scales it per visual state, so it is not necessarily the size drawn. public CompiledMapNodeType NodeType-
The compiled node type this node draws as, and where a view finds its art, colours, and cue ids. The shipped presenter skips a node whose type the content does not declare, so it never binds a null here, but the short constructor allows one.
public NormalizedMapPosition Position-
Where the node sits in normalized layout space, before any framing or scaling. This is the placement to work from when
HasPresentationPositionis false, and it stays meaningful even when it is true. public Vector2 PresentationPosition-
Where to draw the node, in presentation units. Meaningful only when
HasPresentationPositionis true. public string Tooltip-
Node tooltip, already localized. Never null; empty when the node type declares none.
public MapNodeVisualState VisualState-
How the node reads to the player - hidden, locked, available, current, visited, or completed. Derived from progression rather than stored with the node, so it cannot disagree with the run it came from.
MapNodeVisualState¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeState.cs
How one node reads to the player, and the state a presenter styles that node with.
A node can satisfy several of these at once, so the state that wins is the first match in a fixed order: completed, current, available, visited, locked, hidden. Like fog, this is derived from progression rather than stored, so it can never disagree with the save it came from.
| Value | Meaning |
|---|---|
Hidden |
Not discovered yet: not drawn, and skipped by focus and hit-testing. |
Locked |
Discovered but not reachable yet, so it is drawn dimmed rather than hidden. |
Available |
Reachable now: the traveller may enter this node. |
Current |
The node the traveller is on, entered but not yet completed. |
Visited |
Reached earlier with no completion recorded; a completed node reports Completed. |
Completed |
Reached and finished, with its completion result recorded in the progression. |
MapPresenterBase¶
:material-puzzle: Extension point — implement this yourself to change behaviour
Waybranch.Runtime · Runtime/Runtime/MapPresenterBase.cs
Turns a traversal controller's graph, progression and compiled content into live
node and edge views, and keeps them in step for the rest of the run. The shipped
CanvasMapPresenter and WorldMapPresenter both derive from it; a
subclass supplies the two default view factories and otherwise inherits the whole
presentation pass.
Presenting is incremental rather than a rebuild. The layout, the metrics and the
view instances are reused for as long as the graph and content instances stay the
same, and a pass only re-binds the nodes and edges whose derived state actually
changed. That is what makes an ordinary state change cheap, and it is why a view
has to treat IMapNodeView.Bind as idempotent rather than as a fresh
start.
Nothing here writes to the graph or to progression: everything the presenter derives is display state, so a save reopened later is the same run however it was last drawn.
Properties
public int ActiveEdgeCount-
How many edge views the presenter is holding, counted the same way as
ActiveNodeCount. An edge hidden by fog is deactivated rather than released, so it still counts. public int ActiveNodeCount-
How many node views the presenter is holding. Nodes hidden by fog are counted: they are still bound and left active, and drawing them as invisible is the view's own job. Views handed back to a pooling factory are not counted, so this reports what is on the map rather than what has been allocated.
public IMapBackgroundPresenter BackgroundPresenter-
The hook that draws whatever sits behind the map. Assigning one draws it immediately, with the map's style already pushed to it; null draws no backdrop.
public MapLayout CurrentLayout-
The node positions the map is currently drawn from, or null before the first pass and after
Clear. Rebuilt only when the graph or the compiled content instance changes, so the same instance is handed back across ordinary state changes. public IMapFocusIndicatorPresenter FocusIndicator-
The shared focus indicator drawn at the focused node. Assigning one places it on whichever node has focus right now; null leaves focus to the node views.
public StableId FocusedNodeId-
The node currently shown as focused, or an empty id when nothing is. The presenter clears it by itself if that node becomes hidden by fog, so it can change without anyone calling
SetFocusedNode. public IMapLayoutStrategy LayoutStrategy-
The layout that decides where the nodes sit. Assigning one lays the map out again and re-binds the views that survive; null hands the choice back to the presenter, which draws a lane map (a graph of generator version three) with
LaneMapLayoutStrategyat the theme's lane jitter and any other graph with the shipped layered layout. Reading it returns the strategy in force: the one assigned from code; else the presenter's own choice for the presented theme, an object of a type of the presenter's that picks by graph; else, before any map is presented, one layered layout kept by the presenter. Assigning back a value read here while no strategy was assigned from code leaves the choice with the presenter, as null does, so reading and restoring the property never fixes a theme's layout;LayoutStrategyFortells which strategy a theme gets before a map is presented. UnlikeConfigureit keeps the view factories, so nothing is disposed and no pooled view is thrown away. public IMapLocalizationAdapter Localization-
The adapter that turns node labels and tooltips into the player's language. Assigning one re-binds every node so the new text appears at once; null puts the pass-through adapter back, which shows the authored text as-is. The Localization Adapter Component slot fills this in from the inspector while nothing has been installed from code.
public IPlayerPawnPresenter PawnPresenter-
The hook that draws the traveller's own marker. Assigning one places it immediately; null draws no pawn. A pawn that also implements
IMapRoutePawnPresenteris told which edge was crossed as well, so it can walk the route withTryGetEdgePath. public Vector2 PresentationContentSize-
The extent the laid-out map occupies in presentation units, derived from the theme's spacing and the busiest layer of the graph rather than from the views themselves. Zero until the first pass has run. Viewport framing, panning and clamping are all measured against it.
public float PresentationNodeSize-
The unstyled node size in the same units as
PresentationContentSize, or zero until the first pass has run. This is the base size a style then scales per visual state, so it is not necessarily the size drawn; it is used as the margin when keeping a focused node inside the viewport. public IRouteMarkerPresenter RouteMarker-
The hook that marks the route already walked. Assigning one draws the whole visited route immediately; null marks nothing.
public Waybranch.Authoring.CompiledMapStyle Style-
The resolved style this map draws with. Never null: with no preset assigned it returns the shipped default, so the map is never unstyled.
public IMapPresentationTransitionAdapter Transitions-
The adapter that takes over every node and edge transition. Assigning one switches the per-view animation path off; null hands the animations back to the views themselves. The Transition Adapter Component slot fills this in from the inspector while nothing has been installed from code.
public MapTraversalController TraversalController-
The controller being drawn, whether it was assigned in the inspector or through
SetTraversalControllerorConfigure. Null until one is assigned, and a presenter without one draws nothing.
Events
public event Action<MapLayout> LayoutChanged-
Raised at the end of a pass that rebuilt the layout, carrying the new positions, and again with null when
Clearthrows the layout away. It does not fire for an ordinary state change, because the layout is only rebuilt when the graph or the compiled content instance changes. Anything that tracks node positions - a viewport, a minimap, a decoration layer - should listen here instead of pollingCurrentLayoutevery frame.
Methods
public void AdvanceTransitions(float deltaSeconds)-
Advances the state-change animations that node and edge views run for themselves. Driven once a frame from Update on an unscaled delta, so pausing the game does not freeze the map; call it yourself only when you want the map on a clock of your own. It returns without doing anything while an
IMapPresentationTransitionAdapteris installed, because that adapter owns every transition and its own timing. -deltaSeconds— Seconds elapsed since the last advance. Views have to cope with zero and with a very large value after a stall. public void ApplyStyle(Waybranch.Authoring.MapStylePreset preset)-
Replaces the style and pushes it to every live view. Safe at runtime, which is what lets the Style Browser preview a look live. -
preset— Style asset to compile and push immediately; null restores the shipped default. public void Clear()-
Empties the map: every node and edge view goes back to its factory, the layout, metrics and cached geometry are dropped, and focus is released. The factories and adapters themselves are kept, so a later
RefreshorPresentrebuilds the map with the same setup. A focus indicator is told to hide itself, andLayoutChangedis raised with null if there was a layout to throw away. Calling it twice is harmless. public void Configure( MapTraversalController controller, IMapNodeViewFactory nodeFactory, IMapEdgeViewFactory edgeFactory, IMapBackgroundPresenter background = null, IRouteMarkerPresenter route = null, IPlayerPawnPresenter pawn = null, IMapPresentationTransitionAdapter transitions = null, IMapLocalizationAdapter localization = null, IMapLayoutStrategy layoutStrategy = null, IMapFocusIndicatorPresenter focusIndicator = null)-
Replaces the whole presentation setup in one call - the controller, the view factories, and every optional adapter - then clears the map and draws it again from scratch. This is the seam for bringing your own art and your own behaviour. The two factories, the localization adapter and the layout strategy fall back to the shipped defaults when left null; the rest are extra hooks that are simply not installed, so a map configured without a route marker or a pawn presenter draws neither. Each call discards the previous setup, disposing any factory the presenter had created for itself, which is why this is a setup call rather than something to run per frame. To swap a single adapter without that teardown - the localization adapter, the pawn, the layout - assign the matching property instead; only the two view factories have to come through here. -
controller— Controller whose current run and future state events will be presented. -nodeFactory— Supplies node views. Null falls back to the subclass's default factory, which the presenter then owns and disposes with itself. -edgeFactory— Supplies edge views, on the same terms asnodeFactory. -background— Optional backdrop hook, called once at the end of every pass. -route— Optional hook for marking the route already walked. -pawn— Optional hook for the traveller's own marker. -transitions— Optional adapter that takes over every node and edge transition. Installing one switches the per-view animation path off entirely. -localization— Optional adapter for node labels and tooltips. Null shows the authored text as-is. -layoutStrategy— Optional replacement for the presenter's own layout choice (lanes for a lane map, layers otherwise). Null lets the presenter choose. -focusIndicator— Optional shared focus indicator, as an alternative to each view styling its own focus. public IMapLayoutStrategy LayoutStrategyFor(Waybranch.Authoring.CompiledMapTheme theme)-
The strategy a layout pass of this presenter uses for a map drawn with
theme: the one assigned from code (throughLayoutStrategyorConfigure) when there is one, else the presenter's choice, which lays a lane map (a graph of generator version three) out withLaneMapLayoutStrategyat the theme's lane jitter, keeping floors straight when the theme draws Polyline routes, and any other graph with the shipped layered layout. Use it to measure a map before it is presented, for example to frame a camera in the Editor:LayoutStrategyonly knows a theme once a map drawn with it has been presented. Asking changes nothing on the presenter. -theme— The compiled theme the map is drawn with. - Returns — The strategy that lays out a map drawn with that theme. public void Present(MapGraph graph, MapProgressionState progression, MapRuntimeContent content, bool revealAll)-
Draws an explicit graph, progression and content, bypassing the traversal controller. Intended for a map with no live run behind it: a preview, a save slot thumbnail, an editor tool. Display state is derived here from the arguments with the default fog look-ahead, not with an attached controller's own fog settings, so the two paths can disagree about what is hidden. Nothing is written back - drawing a progression cannot advance it - and the next state change from an attached controller redraws over whatever was presented this way. -
graph— Immutable node and edge topology to lay out and bind to views. -progression— Visited, available, current, and completed state used to derive each visual state. -content— Compiled content supplying the theme and the node types. A node whose type is missing from it is skipped. -revealAll— True to leave nothing hidden by fog: an undiscovered node reads as locked instead. public void PushStyleToViews()-
Pushes the current style to every live node and edge view.
public void Refresh()-
Draws the controller's current graph and progression again, or clears the map when there is no initialized controller to draw. The presenter already redraws itself whenever the controller reports a state change, so this is for the cases nothing signals: a controller initialized while the presenter was disabled, or a change made to the map from outside the controller's own events.
public void SetFocusedNode(StableId nodeId)-
Moves the keyboard or gamepad focus treatment to a node, clearing it from whichever node had it. The input controller drives this as focus moves, so a caller only needs it to place focus itself. Focus is display-only: it never selects the node or advances the run. A node hidden by fog is deliberately not shown as focused, and the presenter drops focus by itself if the focused node later becomes hidden. -
nodeId— Node identity to emphasize, or an empty identity to clear focus. public void SetTraversalController(MapTraversalController controller)-
Points the presenter at a different controller, unsubscribing from the previous one and drawing the new one straight away. Factories and adapters installed through
Configureare kept, so this is the call for swapping which run is on screen rather than how it is drawn. Passing the controller already assigned does nothing at all, so it is safe to call repeatedly. -controller— Controller whose graph, progression, and state-change events should now drive this presenter. public void TickStyle(float presentationDeltaSeconds)-
Advances style animation: focus easing, the current-node pulse, and edge flow. Presentation only; nothing advanced here can reach a graph, a save envelope, or a fingerprint. -
presentationDeltaSeconds— Positive presentation-clock interval, in seconds, advanced on every styled live view. public bool TryGetDrawnNodePosition(StableId nodeId, out Vector2 position)-
Looks up where a node is actually drawn, in presentation units: the same position
TryGetPresentationPositionreports, but with the style's flow direction applied, so a marker placed by it lands on the node whichever way the map runs. This is the position the node view was bound with, so it is what a pawn, a tooltip or a camera target should follow. It still comes from the layout rather than from the view's transform, so no transition or focus scaling in flight can move it. -nodeId— Node identity to locate after applying the current style's flow direction. -position— Where the node is drawn, or zero when there is nothing to report. - Returns — False before the first pass has run and for a node the current layout does not hold. public bool TryGetEdgePath(StableId edgeId, out IReadOnlyList<Vector2> points)-
Hands back the path one edge is drawn along, in presentation units, so a caller can walk something of its own down the route - a pawn, a caravan, a trail of dust - instead of sliding it across the map in a straight line. These are the very points the edge view was bound with: sampled from the theme's edge geometry and converted with the style's flow direction applied, so unlike
TryGetPresentationPositionthey match what is drawn under every flow direction. The first point sits on the edge's source node and the last on its target, so the last point is where a pawn crossing that edge comes to rest. The list is read-only and is replaced rather than rewritten when the layout is rebuilt, so a caller that kept one can tell it went stale by comparing instances. -edgeId— Stable identifier for the edge; an empty or unknown ID simply misses. -points— The path from source to target, or null when the edge has not been presented. - Returns — False before the first pass has run and for an edge the current layout does not hold. public bool TryGetPresentationPosition(StableId nodeId, out Vector2 position)-
Looks up a node's laid-out position in presentation units, so a caller can place something of its own beside it - a tooltip, a marker, a camera target - without reaching into the view. The position comes from the layout and the metrics, not from the view's transform, so it is unaffected by any transition or focus scaling in flight. It is the layout position scaled by the content size, with the style's flow direction not applied, so it matches where the node is actually drawn only while that direction runs along the theme's axis unflipped: under
MapFlowDirection.AlongThemeAxis, the default of the shipped styles, and under the screen direction that names the same thing (bottom-to-top for a vertical theme, left-to-right for a horizontal one). Under any other pairing the drawn node is mirrored or transposed against this value, so useTryGetDrawnNodePositionwhen you need where the node really is. It stays as it is because code written against it already places things by it. -nodeId— Node identity to locate in the current unoriented layout. -position— Receives the theme-scaled layout position, or zero when lookup misses. - Returns — False before the first pass has run and for a node the current layout does not hold.
MapRuntimeContent¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContent.cs
Everything needed to draw a map that the graph itself does not carry: the node types its type
IDs resolve to, and the theme they are laid out and styled with. A graph names its node types
by StableId and never reaches for their prefabs, icons, or colors, so this is
the side of the split that decides how a map looks and the graph is the side that decides
what it is -- swapping in different content restyles a map without changing it.
It is immutable and holds nothing scene-specific, so one instance can be shared by the traversal controller, the presenter, and any custom view at once, and reused across every map generated against the same rules. Build it once per theme and content revision rather than per map: the lookup index is built up front, so rebuilding it costs more than keeping it.
Constructors
public MapRuntimeContent(IEnumerable<CompiledMapNodeType> nodeTypes, CompiledMapTheme theme)-
Snapshots the node types and theme, copying the types, sorting them by ID, and indexing them for lookup, so the caller's collection may be changed afterwards without reaching the content. -
nodeTypes— Every node type a graph drawn with this content may name. The sequence may be in any order, but each entry needs a non-empty ID and no two may share one. -theme— Non-null compiled layout and presentation settings retained by this content bundle.
Properties
public IReadOnlyList<CompiledMapNodeType> NodeTypes-
Every node type this content can resolve, ordered by ID rather than by the order they were supplied in. Read-only, and the natural source for a legend or a type picker; resolving one node's type is what
TryGetNodeTypeis for. public CompiledMapTheme Theme-
The theme this content is drawn with: spacing, orientation, edge shape, the backdrop and edge colors, the zoom range, and the state transition duration. Never null, and fixed for the life of the instance -- change the look by building new content, not by mutating this.
Methods
public bool TryGetNodeType(StableId typeId, out CompiledMapNodeType nodeType)-
Resolves a graph node's
MapNode.TypeIdto the content it should be drawn with, through the index built at construction rather than by scanningNodeTypes. -typeId— Graph node-type identity to resolve through the immutable index. -nodeType— Receives the matching compiled presentation contract, or null on a miss. - Returns — False when the graph names a type this content has no entry for, which is how a graph built against a different rules asset shows itself; the view is then responsible for choosing a fallback.
MapRuntimeStateDeriver¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeState.cs
Turns a graph plus the traveller's progression into the per-node fog and visual states a view needs, and is what decides how much of the map the player can currently see.
Discovery walks outward from the nodes actually visited, up to
MapFogSettings.RevealDepth edges - so depth 1 shows only the
immediate next choices, and larger depths reveal further ahead. The result is
derived fresh from progression rather than stored, so it can never drift out
of sync with a loaded save.
Methods
public static MapRuntimeStateSnapshot Derive( MapGraph graph, MapProgressionState progression, bool revealAll, IEnumerable<StableId> unlockedNodeIds)-
Derives fog and visual state with the default one-step look-ahead. Kept so existing callers and saves behave exactly as before. -
graph— Immutable topology whose nodes all receive one derived display state. -progression— Visited, current, available, and completed data that determines state precedence. -revealAll— Whether to expose the entire graph instead of using default one-edge look-ahead. -unlockedNodeIds— Optional node identities treated as discovered even when progression has not reached them. - Returns — A new node-ID-sorted snapshot stamped with the progression revision. public static MapRuntimeStateSnapshot Derive( MapGraph graph, MapProgressionState progression, MapFogSettings fogSettings, IEnumerable<StableId> unlockedNodeIds)-
Derives fog and visual state with explicit fog settings, so a project can choose how far ahead the map is revealed. -
graph— Immutable topology whose nodes all receive one derived display state. -progression— Visited, current, available, and completed data that determines state precedence. -fogSettings— Reveal depth, incoming-edge traversal, and reveal-all policy to sanitize and apply. -unlockedNodeIds— Optional node identities treated as discovered even when progression has not reached them. - Returns — A new node-ID-sorted snapshot stamped with the progression revision.
MapRuntimeStateSnapshot¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeState.cs
The whole map's derived display state for one progression revision: one entry per node, sorted by node ID and addressable by ID.
Immutable once built, so reading it cannot advance traversal or change what the player sees; a move, an unlock, or a change of fog settings needs a newly derived snapshot.
Constructors
public MapRuntimeStateSnapshot(long revision, IEnumerable<MapNodeRuntimeState> nodes)-
Copies and sorts the supplied states; a null sequence yields an empty snapshot. -
revision— Progression revision from which these display states were derived. -nodes— One state per node, in any order.
Properties
public IReadOnlyList<MapNodeRuntimeState> Nodes-
Every node's state, sorted by node ID rather than by progress or layout.
public long Revision-
The progression revision this state was derived from. It tracks progression only, so two snapshots can carry the same revision and still differ, for instance when the fog settings changed between them.
Methods
public bool TryGet(StableId id, out MapNodeRuntimeState state)-
Looks one node's state up by ID instead of scanning
Nodes. -state— Receives the indexed visual and fog state, or its default value on a miss. -id— Graph-node identity to resolve in the snapshot index. - Returns — True when the snapshot holds that node. A node missing here is one the snapshot was not derived for, not a concealed one: concealed nodes are present and reportMapFogState.Hidden.
MapSelectionResult¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
The outcome of asking the controller to move to a node.
It separates a request that never reached the traversal session - an unknown
node, a node that is not available, or a controller already dispatching
callbacks - from one that did, where Transition carries the
session's accept or reject.
Properties
public StableId NodeId-
The node the request named, echoed back whatever became of it - including for a request that was dropped, and for an id the graph does not hold. It lets a caller match a result to the click that produced it without keeping the id itself.
public bool Succeeded-
True only when a move was attempted and the session accepted it, so an ignored request never reads as a success.
public MapTransitionResult Transition-
The session's result for the move, or null when the request never reached the session.
public bool WasAvailable-
Whether the node was available when the request arrived. False on a request that was dropped without being attempted.
Methods
public static MapSelectionResult Attempted(StableId nodeId, bool wasAvailable, MapTransitionResult transition)-
Records a request that reached the session, carrying the result it produced. -
transition— The immutable session result. Null is permitted to represent a request that reached controller routing but produced no session transition. -nodeId— The node named by the request, preserved unchanged for correlation. -wasAvailable— Whether the node passed the controller's availability check when the request was handled. - Returns — A result that distinguishes availability from the transition's own typed success or failure. public static MapSelectionResult Ignored(StableId nodeId)-
Records a request that was dropped before the session saw it:
Transitionstays null andSucceededis false. -nodeId— The requested node, including an unknown ID; it is echoed for input/result correlation and is not validated here. - Returns — A failed result withWasAvailablefalse and no transition.
MapSetupHierarchyBinding¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapSetupHierarchyBinding.cs
Durable identity for scene objects created and owned by the Waybranch setup wizard.
Properties
public Transform Content-
The transform the presenter sits on and node and edge views are parented to -- under
SafeAreaon a Canvas setup, directly under this object otherwise. It is owned by setup on the same terms as the safe area, so unrecognized components or children on it block repair rather than being deleted. public bool IsCanvas-
True when the recorded hierarchy is the Canvas shape -- a safe-area rect with the map content beneath it -- and false when it is the world-space one. Running setup for the other shape destroys the recorded objects and rebuilds them, so this is what tells the wizard the two do not match.
public Component OptionalInputBridge-
The Input System bridge component setup added, or null when setup ran without Input System support. It is typed as
Componentso this assembly never has to reference the Input System package; the concrete type is resolved by name at setup time and is absent from builds that do not have the package installed. public InputSystemSignalAdapter OptionalInputSignals-
The signal adapter setup wired to the bridge, or null when the optional input path was not installed. Recording it is what lets a later run remove exactly the components setup created instead of stripping ones you added by hand.
public RectTransform SafeArea-
The safe-area rect the wizard created under this object, or null on a world-space setup. Setup owns it and may delete it, so anything of yours parented into it stops setup: it reports the hierarchy as holding customer content rather than removing your objects.
Methods
public void Configure(bool usesCanvas, RectTransform ownedSafeArea, Transform ownedContent)-
Records which objects setup owns, replacing whatever was recorded before. This is bookkeeping only: it creates, reparents, and destroys nothing, so passing nulls is how setup clears the record after it has already destroyed those objects itself. -
usesCanvas— True for the Canvas hierarchy, false for the world-space one. -ownedSafeArea— Wizard-created safe-area rect, or null for a world-space hierarchy. -ownedContent— Wizard-created content root holding the presenter and generated views. public void ConfigureOptionalInput(Component ownedBridge, InputSystemSignalAdapter ownedSignals)-
Records the optional Input System components setup owns, replacing whatever was recorded before. Like
Configureit only writes the record; passing nulls is how setup clears it after removing those components, which is what happens when setup is re-run with Input System support switched off or the package is not installed. -ownedBridge— Optional PlayerInput bridge component created by setup, or null when absent. -ownedSignals— Signal adapter paired withownedBridge, or null when absent.
MapStringUnityEvent¶
Waybranch.Runtime · Runtime/Runtime/MapTraversalController.cs
Inspector-serializable event that publishes one stable ID as text.
MapSurfaceStyling¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapSurfaceStyling.cs
Turns a node's compiled type, visual state, and fog state into the surface request that draws it.
Keeping this a pure function of its inputs means the same mapping drives the runtime views, the Map Studio graph, and the Style Browser previews, so what an author sees while editing is what ships. It also makes the mapping directly testable without a canvas.
It lives in the shared runtime assembly rather than beside the Canvas views on purpose: a style has nothing to do with uGUI, and putting the mapping here is what lets the Canvas and World2D presentations agree on what a node of a given state should look like instead of each deciding separately.
Methods
public static MapSurfaceRequest BuildBackdrop(CompiledMapStyle style)-
Combines palette and backdrop tokens into a full-surface gradient, vignette, and grid request. -
style— Compiled backdrop appearance to apply; null selects the shipped default. - Returns — A stroke-free shape request ready to cover the map background. public static MapSurfaceRequest BuildEdgeSegment( CompiledMapStyle style, Color edgeColor, float segmentLength, bool leadsToAvailable, bool isLastSegment, float dashOffset)-
Builds shader parameters for one straight segment of a styled multi-point route. -
style— Compiled route appearance to apply; null selects the shipped default. -edgeColor— Already resolved traversal-role color including presentation alpha. -segmentLength— Source-to-target length in local presentation units. -leadsToAvailable— Whether available-route width, glow, and dash motion should be emphasized. -isLastSegment— Whether this segment receives the route's terminal cap or arrowhead. -dashOffset— Current animated displacement of the dash pattern in local units. - Returns — An edge-mode request ready to apply to the shared map-surface shader. public static MapSurfaceRequest BuildNode( CompiledMapStyle style, Color stateColor, MapNodeVisualState visualState, MapFogState fogState, float pulsePhase)-
Composes node-type color, progression treatment, fog, pulse, and style tokens into shader parameters. -
style— Compiled appearance to apply; null selects the shipped default. -stateColor— Node type's base tint for the current visual state. -visualState— Progression role selecting brightness, opacity, scale, ring, and glow treatment. -fogState— Derived visibility tier multiplied into the state treatment. -pulsePhase— Normalized repeating phase used only to modulate current-node glow; zero disables modulation. - Returns — A shape-mode request ready to apply to the shared map-surface shader.
MapTraversalController¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapTraversalController.cs
The scene component that owns one traversal run: it holds the graph, the
progression, and the compiled content, applies every move through a
MapSession, and reports what happened as C# events, as
inspector-wired UnityEvents, and as a derived per-node display snapshot.
One operation runs at a time. A selection, a completion, an initialize, or a development command issued from inside a callback the controller is already dispatching is refused rather than nested, because a nested call would commit progression on top of state the outer call is still reporting. A refusal comes back as a result value rather than an exception, so a view may call in straight from a click handler without guarding. The single exception is the regenerate command in a build that defines WAYBRANCH_DEVTOOLS, which deliberately opens one nested initialize for its handler and closes it again afterwards.
Listeners are isolated from one another: one that throws is caught, the
remaining listeners still run, the committed transition still stands, and the
failure is appended as a warning to LastControllerValidation. That
warning is only recorded, not announced: a throwing C# listener or UnityEvent
slot does not raise ValidationFailed, so read the property after a
dispatch when a failing listener has to be noticed. A throwing
AudioCueAdapter is the one callback whose warning is published.
In a build that defines WAYBRANCH_DEVTOOLS the component additionally implements IMapDevelopmentHost, which is the surface the development overlay drives.
Properties
public IMapAudioCueAdapter AudioCueAdapter-
The hook that plays the enter and complete cue ids authored on node types. Leaving it null plays nothing; the controller has no audio of its own. It is called from inside a transition dispatch, and only when the node's compiled type declares a cue id that parses as a stable id. An exception thrown from it is recorded as a callback-failed warning rather than undoing the transition, and driving traversal from inside it is refused as a nested operation. The Audio Cue Adapter Component slot answers this from the inspector while nothing has been installed from code, so a scene can be wired up without writing any.
public MapUnityEvent AvailabilityChangedUnityEvent-
The first serialized slot for
AvailabilityChanged. It takes no argument, so a slot that needs the new set reads it back fromState. Never null. public MapRuntimeContent Content-
The compiled node types and theme this run was initialized with, or null before the first successful initialize. The controller reads it to confirm every node in the graph has a compiled type, and to look up the cue ids it hands to
AudioCueAdapter. public MapFogSettings FogSettings-
How far ahead of the traveller the map is revealed. Fog is derived rather than stored, so changing this re-reveals an existing save correctly with no migration.
public MapGraph Graph-
The graph currently being traversed, or null before the first successful initialize. A refused initialize leaves the previous graph in place.
public bool IsInitialized-
Whether a traversal session exists. It stays true once a run has finished, so the final state can still be read, and it keeps reporting the previous run when an initialize is refused.
public ValidationReport LastControllerValidation-
The most recent report the controller recorded: never null, and emptied by a successful initialize. It also collects the callback failures that are never announced through
ValidationFailed, so read it whenever a call returns false or a refusal - and after a dispatch when a throwing listener matters - since problems are recorded here rather than logged or thrown. public MapUnityEvent MapCompletedUnityEvent-
The first serialized slot for
MapCompleted, the usual place to wire an end-of-run screen from the inspector. Never null. public MapUnityEvent MapGeneratedUnityEvent-
The first serialized slot for
MapGenerated, which is the one the inspector shows. Never null: an empty or cleared slot list is repopulated on access, so a listener added from code always has somewhere to attach. public MapStringUnityEvent NodeCompletedUnityEvent-
The first serialized slot for
NodeCompleted, invoked with the completed node's id as text. The result payload is not carried; read it from the C# event when it matters. Never null. public MapStringUnityEvent NodeEnteredUnityEvent-
The first serialized slot for
NodeEntered, invoked with the entered node's id as text. The rest of the transition event is not carried, so use the C# event when a listener needs the revision or the available set. Never null. public MapStringUnityEvent NodeSelectionRequestedUnityEvent-
The first serialized slot for
NodeSelectionRequested, invoked with the node's id as text rather than as aStableId, because a UnityEvent argument has to be a type the inspector can serialize. Never null. public bool RevealAll-
Whether the development reveal-all override is on. Only the development command sets it, and an initialize or a development reset clears it, so it is always false in a build that does not define WAYBRANCH_DEVTOOLS. To reveal a map in a shipping build set
MapFogSettings.RevealAllthroughFogSettingsinstead. public MapUnityEvent SaveRequestedUnityEvent-
The first serialized slot for
SaveRequested. It carries neither the graph nor the progression, so a slot wired here has to read them back fromGraphandState. Never null. public MapSerializedEventBridge SerializedEvents-
The inspector-wired UnityEvent hooks, for scenes that wire behaviour up without writing code. Each hook is a list of independent slots, invoked one at a time behind an exception guard so a misbehaving slot cannot stop the rest. They fire only while the component's Invoke Serialized Events flag is on; the C# events are the surface to prefer from code.
public MapProgressionState State-
The progression committed so far, or null before the first successful initialize. Each accepted transition replaces the whole value instead of mutating it, so a stored reference keeps reporting the revision it was read at.
public MapUnityEvent ValidationFailedUnityEvent-
The first serialized slot for
ValidationFailed. The report itself is not carried; a slot wired here readsLastControllerValidationto see what was recorded. Never null.
Events
public event Action<MapTransitionEvent> AvailabilityChanged-
Raised when the set of choosable nodes changed, with the new set on
MapTransitionEvent.AvailableNodeIdsand an emptyMapTransitionEvent.NodeId, because the change concerns the map rather than one node. Entering a node also raises it, with an empty set: nothing else is choosable until that node is completed. public event Action<uint> DevelopmentRegenerateRequested-
Raised by
DevelopmentRegeneratewith the seed to build from. The handler is expected to generate the replacement map and initialize the controller before it returns: exactly one nested initialize is opened for the duration of the call, and the command reports failure if it does not happen. Exists only in a build that defines WAYBRANCH_DEVTOOLS. public event Action<MapTransitionEvent> MapCompleted-
Raised when the completed node had no outgoing edges and the run is therefore over. It follows
NodeCompletedfor the same node rather than replacing it, so an end-of-run screen belongs here and not on the last completion. public event Action<MapGraph> MapGenerated-
Raised when an initialize succeeds, carrying the graph now being traversed. It fires for a restored save exactly as it does for a freshly generated map, so read it as "the map was replaced" rather than "a map was generated". It arrives before the first
StateChangedof the new run. public event Action<MapTransitionEvent> NodeCompleted-
Raised when the current node has been finished, carrying the completion data it was given on
MapTransitionEvent.ResultPayload. public event Action<MapTransitionEvent> NodeEntered-
Raised once the traveller has moved onto a node. The move is already committed by the time it arrives, so a listener reacts to it rather than vetoing it.
public event Action<StableId> NodeSelectionRequested-
Raised for each
RequestNodeSelectionnaming a node that exists in the graph, before availability is tested - so it also fires for a node the traveller cannot enter, which is where a "locked" click response belongs. A request naming an unknown id raises nothing at all. public event Action<MapGraph, MapProgressionState> SaveRequested-
Raised by
RequestSavewith the graph and the progression to persist. The controller writes nothing itself, so nothing is saved until a listener does it; both values are immutable snapshots, so a handler may hold them while it serializes. public event Action<MapRuntimeStateSnapshot> StateChanged-
Raised after every committed change with a freshly derived
MapRuntimeStateSnapshotfor the whole map. This is what a presenter redraws from: fog and any development overrides are already folded in, so a view never has to combine the graph and the progression itself. public event Action<ValidationReport> ValidationFailed-
Raised whenever the controller publishes a report: a refused initialize, a transition the session turned down, a transition that carried warnings, or an
AudioCueAdapterthat threw. A C# listener or UnityEvent slot that throws does not raise it - that failure is only appended toLastControllerValidation. Not every report is fatal - a callback failure arrives as a warning-only report - so checkValidationReport.IsValidrather than assuming the run has stopped.
Methods
public MapTransitionResult CompleteCurrent()-
Finishes the node the traveller is on and records an empty result, which is what an encounter with no outcome data to hand back calls. - Returns — Whatever the payload overload returns: null when the controller is not initialized, a refusal carrying
MapTransitionFailureKind.TransitionInProgresswhen the call came from inside a callback the controller is already dispatching, and otherwise the session's result. public MapTransitionResult CompleteCurrent(MapDataPayload result)-
Finishes the node the traveller is on and records
resultagainst it, so later branching and a reloaded save can both read what happened there. Completing is what makes the next nodes choosable: it raisesNodeCompletedfollowed byAvailabilityChanged, or byMapCompletedinstead when the node had no outgoing edges. -result— Completion data to record. A null or non-canonical payload is refused rather than stored. - Returns — The session's result; null when the controller is not initialized, and a refusal carryingMapTransitionFailureKind.TransitionInProgresswhen the call came from inside a callback the controller is already dispatching. public MapDevelopmentCommandResult CopyGenerationManifest()-
Collects the fields that identify how this map was generated - generator and graph format versions, seed, rules and graph fingerprints, and generation key - as semicolon-separated key=value text, which is what makes a bug report against a procedural map reproducible. Despite the name it does not touch the system clipboard: the text comes back on
MapDevelopmentCommandResult.Valueand the caller decides what to do with it. Exists only in a build that defines WAYBRANCH_DEVTOOLS. - Returns — A refusal carryingMapDevelopmentFailureKind.NotInitializedwhen there is no run to describe. public MapDevelopmentCommandResult DevelopmentCompleteCurrent()-
Completes the node the traveller is on with an empty result, as if its encounter had finished normally - so it goes through the ordinary transition rules and raises the ordinary events rather than going around them. Exists only in a build that defines WAYBRANCH_DEVTOOLS. - Returns — A refusal carrying
MapDevelopmentFailureKind.RejectedTransitionwhen there is no run, no current node to complete, or the transition was otherwise turned down. public MapDevelopmentCommandResult DevelopmentForceResult(MapDataPayload result)-
Completes the current node with a chosen result payload, which is how branching that keys off an outcome gets exercised without playing the encounter that produces it. Exists only in a build that defines WAYBRANCH_DEVTOOLS. -
result— The completion data to record. It must be canonical. - Returns — A refusal carryingMapDevelopmentFailureKind.InvalidPayloadwhenresultis null, orMapDevelopmentFailureKind.RejectedTransitionwhen the payload is not canonical or there is no current node to complete. public MapDevelopmentCommandResult DevelopmentRegenerate(uint seed)-
Asks the registered
DevelopmentRegenerateRequestedhandler for a fresh map built fromseed. The handler has to generate the map and initialize the controller before it returns. A single nested initialize is opened for the duration of the call and closed again afterwards, and the command reports failure when that initialize did not happen - which is what stops an asynchronous handler from leaving the overlay claiming a success it never got. Exists only in a build that defines WAYBRANCH_DEVTOOLS. -seed— The generation seed to rebuild from. - Returns — A refusal carryingMapDevelopmentFailureKind.Unsupportedwhen no handler is registered, orMapDevelopmentFailureKind.RejectedTransitionwhen the handler did not synchronously initialize a replacement map. public MapDevelopmentCommandResult DevelopmentReset()-
Restarts the run on the same graph: progression goes back to the beginning, and the development unlocks and the reveal-all override are dropped. The compiled content is kept, so this is cheaper than re-initializing and cannot fail on content. Exists only in a build that defines WAYBRANCH_DEVTOOLS. - Returns — A refusal carrying
MapDevelopmentFailureKind.NotInitializedwhen there is no run to reset. public MapDevelopmentCommandResult DevelopmentRevealAll(bool reveal)-
Turns the reveal-all override on or off and republishes the map's display state, without touching progression. Exists only in a build that defines WAYBRANCH_DEVTOOLS. -
reveal— True to show every node; false to go back to derived fog. - Returns — A refusal carryingMapDevelopmentFailureKind.NotInitializedwhen there is no run, orMapDevelopmentFailureKind.RejectedTransitionwhen another operation is already dispatching. public MapDevelopmentCommandResult DevelopmentTeleport(StableId nodeId)-
Moves the traveller straight to a node, fabricating the route and the completions it would have taken to get there. A breadth-first search from the graph's start nodes supplies the path, and every node along it bar the destination is recorded as completed with an empty result, so the rebuilt progression is still a legal route and can still be saved. Those completions are invented, so branching that keys off a real result payload will not find one. Exists only in a build that defines WAYBRANCH_DEVTOOLS. -
nodeId— The node to stand the traveller on. It must be reachable from a start node. - Returns — A refusal carryingMapDevelopmentFailureKind.InvalidNodewhen the id is empty or unreachable, orMapDevelopmentFailureKind.RejectedTransitionwhen the revision cannot advance or the fabricated progression is turned down. public MapDevelopmentCommandResult DevelopmentUnlock(StableId nodeId)-
Makes one node display as available whatever the progression says, so a branch can be inspected without walking to it. It changes derived display state only. Traversal still consults the session, so
RequestNodeSelectiongoes on refusing the node. The unlock is remembered until the next initialize or development reset. Exists only in a build that defines WAYBRANCH_DEVTOOLS. -nodeId— The node to show as available. - Returns — A refusal carryingMapDevelopmentFailureKind.InvalidNodewhen the id is empty or names no node in the graph. public MapRuntimeStateSnapshot GetRuntimeState()-
Returns the derived display state of every node - the visual state a presenter styles it with, and how far fog conceals it - for the progression as it now stands. The snapshot is derived rather than stored, then cached until something invalidates it, which a transition, a replaced session, and a change to
FogSettingsall do. Because it is derived it can never disagree with the save it came from, so changing how far ahead the map is revealed needs no migration. - Returns — The current snapshot, or an empty one at revision 0 when the controller is not initialized. public bool Initialize(MapGraph graph, MapRuntimeContent content)-
Starts a fresh run at the beginning of
graph, with no progression restored. -graph— Immutable topology to validate and start from its initial entry nodes. -content— Compiled node types and theme. Every node type the graph uses must be present. - Returns — False when the map was refused - the previous run is untouched andLastControllerValidationexplains why - and also false when the call arrived from inside a callback the controller is already dispatching, which is turned down without recording a report. public bool Initialize(MapGraph graph, MapProgressionState restoredState, MapRuntimeContent content)-
Adopts a graph together with progression read back from a save, replacing whatever run was in progress. The graph is refused when a node names a type
contentdoes not compile, and the progression is refused when it does not describe one legal ordered route through that graph - which is what stops a tampered or mismatched save from standing the traveller somewhere unreachable. Nothing is replaced on a refusal. On success the reveal-all override and any development unlocks are dropped,LastControllerValidationis emptied, andMapGeneratedis raised before the firstStateChanged. -graph— Immutable topology that must match every node and transition in the restored progression. -restoredState— Progression to resume from; null starts at the beginning of the graph. -content— Compiled node types and theme. Every node type the graph uses must be present. - Returns — False when the graph or the progression was refused, or when the call arrived from inside a callback the controller is already dispatching. public MapSelectionResult RequestNodeSelection(StableId nodeId)-
Asks to move the traveller onto a node, which is what a click on the map should call. The request never reaches the session when the controller is not initialized, when another operation is already dispatching, when the id names no node in the graph, or when the node is not currently available. That last case still raises
NodeSelectionRequestedfirst, so an unavailable node can be answered with feedback. Anything else goes toMapSession.TryEnter, which may still turn it down. -nodeId— Graph-node identity requested by pointer, keyboard, gamepad, or host routing. - Returns — A result that tells a dropped request apart from an attempted one. CheckMapSelectionResult.Succeededrather than assuming the move happened. public void RequestSave()-
Asks whoever is listening to persist the run, by raising
SaveRequestedwith the current graph and progression. The controller stores nothing itself, so this does nothing until a save adapter is wired up, and nothing at all before the first successful initialize. Unlike the other operations it may be called from inside a controller callback, which is what lets a project save onNodeCompleted: it only reads state, so nothing can be committed underneath the outer call. A call made from inside aSaveRequestedhandler is ignored, so a handler cannot drive itself in a loop.
MapUnityEvent¶
Waybranch.Runtime · Runtime/Runtime/MapTraversalController.cs
Inspector-serializable signal used when listeners can read details from the controller.
PassthroughLocalizationAdapter¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/MapRuntimeContracts.cs
The IMapLocalizationAdapter used when a project has no
localization system wired up: it returns the authored fallback text
unchanged, falling back to the key itself when no text was authored.
Returning the key rather than an empty string is deliberate - a missing string shows up on screen as a visible identifier you can search for, instead of a blank label that looks like a layout bug.
Methods
public string Resolve(string key, string fallback)-
Returns
fallbackwhen it has text, otherwisekey, never null. -key— The authored localization key, used only when no fallback text was supplied; null is treated as empty. -fallback— The authored display text; any non-empty value is returned unchanged. - Returns — The fallback when present, otherwise the key; never null.
Rule¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapCaptionSpots.cs
The rules a place for a name can break, as flags: what MapCaptionSpots.Explain counts.
| Value | Meaning |
|---|---|
None |
None: the place holds every rule. |
Reach |
Farther from its own node than the reach. |
Strip |
At a corner of its node's rectangle: it shares no stretch of the node's column or row. |
Nearest |
Its own node is not clearly the nearest (the ratio, or the margin). |
Area |
Outside the area a name may stand in. |
Body |
Over a body, a name placed before it or the traveller. |
Route |
On the stroke of a route. |
RuntimeExperienceInputRegistry¶
:material-star: Start here
Waybranch.Runtime · Runtime/Runtime/Experience/RuntimeExperienceInputRegistry.cs
Assembly-neutral factories for optional experience input integrations.
Methods
public static void RegisterEventModuleFactory(Func<GameObject, Component> factory)-
Registers or replaces the optional EventSystem-module factory. -
factory— Factory invoked to create an optional integration for an owner object. public static void RegisterInputFactory(Func<GameObject, IMapInputSource> factory)-
Registers or replaces the optional input-source factory. -
factory— Factory invoked to create an optional integration for an owner object. public static void RegisterInputQuery(IMapExperienceInputQuery query)-
Registers or replaces the optional keyboard and pointer query the experience HUDs read where legacy Input does not exist. -
query— Query served by an input integration, or null to remove it. public static bool TryCreateEventModule(GameObject owner, out Component module)-
Creates an optional EventSystem input module when a provider is installed. -
module— Created event module returned to the caller. -owner— GameObject that owns the optional integration component. - Returns — True when an installed provider creates an event module. public static bool TryCreateInput(GameObject owner, out IMapInputSource source)-
Invokes the installed provider for the owner and returns its optional package-neutral input source. -
owner— GameObject that owns the optional integration component. -source— Created input source returned to the caller. - Returns — True when an installed provider creates an input source. public static bool TryGetInputQuery(out IMapExperienceInputQuery query)-
Returns the keyboard and pointer query an installed integration registered. -
query— The registered query, or null. - Returns — True when an integration registered a query.
Side¶
Waybranch.Runtime · Runtime/Runtime/Experience/MapCaptionSpots.cs
The side of a node a name stands on. Above is towards larger y: every plane the renderers use has y up.
UIToolkitMapRenderer¶
:material-star: Start here
public sealed class UIToolkitMapRenderer : MonoBehaviour, IMapExperienceInteractiveRenderer, IMapExperienceCameraRenderer, IMapExperienceElementRenderer, IMapExperienceInputOwnership, IMapExperiencePickingRenderer, IMapExperienceLayoutEditingRenderer, IMapExperienceLayoutManipulationRenderer, IMapExperienceViewportRenderer, IMapExperienceUiInputOwnership, IMapExperienceTravelRenderer, IMapExperienceTransitions
Waybranch.Presentation.UIToolkit · Runtime/Presentation/UIToolkit/UIToolkitMapRenderer.cs
Renders Waybranch snapshots with UI Toolkit. Nodes are VisualElements owned by the UIDocument and routes are custom mesh elements; no GameObject is created per node or edge. The host remains responsible for traversal commands and supplies fresh immutable view data.
Properties
public VisualElement Root-
The current UIDocument root used by this renderer.
Events
public event Action ConfirmRequested-
Raised when the renderer requests confirmation of the focused node.
public event Action<StableId, Vector2> NodeOffsetRequested-
Raised by optional editor Ctrl-drag layout editing with a normalized map-space delta.
public event Action<StableId> NodeRequested-
Raised when the renderer requests a specific node.
public event Action<StableId> SelectionRequested-
Raised when a player selects an available or current node.
Methods
public void AttachTo(VisualElement target)-
Mounts the same renderer tree into an editor preview or another UI Toolkit panel.
public void BuildDocument()-
Rebuilds the document tree from the assigned template or the shipped UXML template.
public void Clear()-
Releases presentation-owned runtime objects.
public void ClearPresentation()-
Removes all presented nodes and routes without destroying the UIDocument.
public void ConfigureCamera(Camera camera)-
Configures the camera used for projection and presentation. -
camera— Camera used for scene-space projection. public void ConfigurePanelScaling(Vector2 referenceResolution, float match)-
Scales the panel this renderer creates with the screen, so a node keeps its share of the picture at every resolution. -
referenceResolution— Resolution at which one panel unit is one pixel. -match— 0 matches the width, 1 the height, 0.5 both equally. public void ConfigureViewport(Rect normalizedViewport)-
Places the outer document within the game's reserved screen area, preserving template contents.
public void HandleInput(MapInputFrame input)-
Applies one package-neutral input frame. -
input— Input source polled by the host. public bool OwnsElement(VisualElement element)-
Allows shared-panel map input while preserving focus and clicks owned by other controls.
public void Present(MapExperienceSnapshot snapshot)-
Presents the latest immutable snapshot. -
snapshot— Immutable experience snapshot to present or evaluate. public void Present(IReadOnlyList<MapNodeViewData> nodes, IReadOnlyList<MapEdgeViewData> edges)-
Consumes the host's immutable node and edge view snapshots in one presentation pass.
public void RequestConfirm()-
Asks the host to complete the currently focused node through its common command path.
public void SetFocus(StableId nodeId)-
Updates presentation focus without changing progression. -
nodeId— Stable identity of the node being entered, focused, or queried. public void SetHostInputOwnership(bool ownsInput)-
Lets the host take ownership of keyboard, gamepad, pan and zoom input.
public void SetLayoutEditingEnabled(bool enabled)-
Enables the editor-only Ctrl-drag layout gesture without changing runtime input ownership.
public void SetSelectionHandler(Action<StableId> handler)-
Registers the traversal command callback supplied by the host.
public bool TryGetScreenPosition(StableId nodeId, out Vector2 screenPosition)-
Projects a known node into camera screen coordinates; projection success does not guarantee visibility. -
nodeId— Stable identity of the node being entered, focused, or queried. -screenPosition— Screen-space position in pixels. - Returns — True when the renderer can project the node and writes its position; false otherwise. Check viewport and visibility separately when placing overlays. public bool TryHit(Vector2 screenPosition, out StableId nodeId)-
Resolves a visible node in camera screen coordinates. -
nodeId— Stable identity of the node being entered, focused, or queried. -screenPosition— Screen-space position in pixels. - Returns — True when a visible node was hit and its ID was written; false otherwise. public bool TryScreenToMap(Vector2 screenPosition, out Vector2 mapPosition)-
Projects a camera-screen position onto the renderer's map plane. -
mapPosition— Map-space position produced by the conversion. -screenPosition— Screen-space position in pixels. - Returns — True when the screen point converts to a map position; false otherwise.
WaybranchMapHost¶
:material-star: Start here
Waybranch.Runtime · 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 MapStringUnityEvent HostFailedUnityEvent-
Inspector-safe failure-message counterpart to
HostFailed. public MapUnityEvent HostReadyUnityEvent-
Inspector-safe counterpart to
HostReady. 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 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.
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— Traversal controller to attach to host events and progression. -mapPresenter— Presenter that will visualize the controller's graph and state. public MapHostOperationResult CompleteCurrent()-
Completes the current node with an empty result. - Returns — A typed completion result; success clears the active routed selection.
public MapHostOperationResult CompleteCurrent(MapDataPayload resultPayload)-
Completes the current node with canonical customer result data. -
resultPayload— Canonical game result recorded against the current node's completion. - Returns — A typed completion result; success records the payload and clears the active routed selection. public void ConfigureForScene( MapBlueprintAsset mapBlueprint, MapThemeAsset mapTheme, MapTraversalController controller, MapPresenterBase mapPresenter, MapContentPoolAsset pool = null, bool startAutomatically = false, string slotId = null)-
Configures the serialized golden path used by the Setup Wizard. -
mapBlueprint— Blueprint whose rules, graph rows, mode, and seed define the run. -mapTheme— Theme compiled into runtime layout and viewport settings. -controller— Traversal controller that owns progression for the generated or loaded graph. -mapPresenter— Optional presenter rebuilt when the controller publishes a graph. -pool— Optional deterministic content pool used when nodes are entered. -startAutomatically— WhetherStartfirst tries the save slot and creates a run when it is absent. -slotId— Optional stable save-slot text; null or empty preserves the serialized slot. public void ConfigureForScene( MapBlueprintAsset mapBlueprint, MapThemeAsset mapTheme, MapStylePreset mapStyle, MapTraversalController controller, MapPresenterBase mapPresenter, MapContentPoolAsset pool = null, bool startAutomatically = false, string slotId = null)-
Configures the serialized golden path used by the Setup Wizard, including the run's style. -
mapBlueprint— Blueprint whose rules, graph rows, mode, and seed define the run. -mapTheme— Theme compiled into runtime layout and viewport settings. -mapStyle— The style pushed to the presenter when a run starts. Null leaves the presenter's own style alone. -controller— Traversal controller that owns progression for the generated or loaded graph. -mapPresenter— Optional presenter rebuilt when the controller publishes a graph. -pool— Optional deterministic content pool used when nodes are entered. -startAutomatically— WhetherStartfirst tries the save slot and creates a run when it is absent. -slotId— Optional stable save-slot text; null or empty preserves the serialized slot. public MapHostOperationResult RequestNode(string nodeId)-
Parses a stable ID, resolves content, and requests entry into that node. -
nodeId— Stable node identity text to parse before availability and content checks. - Returns — A typed entry result with the committed content selection when traversal succeeds. public MapHostOperationResult RequestNode(StableId nodeId)-
Resolves content before atomically committing traversal into an available node. -
nodeId— Parsed identity of the available node to resolve and enter. - Returns — A typed entry result with the committed content selection when traversal succeeds. public MapHostOperationResult Save()-
Persists the active graph, progression, routed content, and current customer metadata atomically. - Returns — A typed save result carrying adapter diagnostics and the specific persistence failure kind.
public MapHostOperationResult Save(MapDataPayload customerMetadata)-
Persists the active run atomically with caller-owned metadata encoded beside host routing state. -
customerMetadata— Canonical game-specific payload to restore independently of Waybranch's internal metadata. - Returns — A typed save result carrying adapter diagnostics and the specific persistence failure kind. public void SetContentResolver(IMapNodeContentResolver resolver)-
Overrides the serialized resolver for code-driven integrations and tests. -
resolver— Runtime content resolver to use instead of the serialized pool or component; null clears the override. public void SetSaveAdapter(IMapSaveAdapter adapter)-
Overrides the serialized persistence choice for code-driven integrations and tests. -
adapter— Runtime save adapter to use instead of the serialized adapter choice; null clears the override. public MapHostOperationResult StartNew()-
Generates and commits a fresh run using the host's configured seed policy. - Returns — The typed generation and initialization outcome; failure leaves no partially committed new run.
public MapHostOperationResult StartNew(uint seed)-
A fresh run is generated from the explicit deterministic seed and committed only after initialization succeeds. -
seed— Explicit unsigned deterministic seed; equal inputs and seed produce equal canonical output. - Returns — The typed generation and initialization outcome; failure leaves no partially committed new run. 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 typed generation and initialization outcome, including cancellation as a generation failure. 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( uint seed, CancellationToken cancellationToken, Action<MapHostOperationResult> completed)-
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()-
Reads, validates, and restores the configured save slot without throwing for an expected miss. - Returns — A typed load result; the active run changes only after envelope, identity, content, and controller checks pass.
World2DExperienceNodeClick¶
:material-star: Start here
Waybranch.Presentation.World2D · Runtime/Presentation/World2D/World2DExperienceRenderer.cs
World2D pointer bridge for one stable node ID.
Properties
public StableId Id-
Stable ID emitted on click.
public World2DExperienceRenderer Owner-
Owning renderer.
World2DExperienceRenderer¶
:material-star: Start here
public sealed class World2DExperienceRenderer : MonoBehaviour, IMapExperienceInteractiveRenderer, IMapExperienceCameraRenderer, IMapExperiencePickingRenderer, IMapExperienceLayoutEditingRenderer, IMapExperienceViewportRenderer, IMapExperienceFreeRectRenderer, IMapExperienceTravelRenderer, IMapExperienceTransitions
Waybranch.Presentation.World2D · Runtime/Presentation/World2D/World2DExperienceRenderer.cs
Snapshot-driven World2D adapter using pooled sprites and line routes.
Properties
public float MapScale-
World units used for one normalized map coordinate.
Events
public event Action ConfirmRequested-
Raised when the renderer requests confirmation of the focused node.
public event Action<StableId> NodeRequested-
Raised when the renderer requests a specific node.
Methods
public void Clear()-
Clears active objects while retaining their pools.
public void ConfigureCamera(Camera camera)-
Fits a supplied world camera to the current map bounds. -
camera— Camera used for scene-space projection. public void ConfigureCaptionOverhang(float pixels, bool openWays = false)-
Lets the name of the node in focus and of the current node stand a little past the free area when no place inside it reads as its node's. The name of an open way that finds no place inside the area, and the name of a visited node, may take that margin too, but only after every other name is placed and the traveller has found its own place, so no other name moves for them. Every name stays inside the area, as
ConfigureFreeRectpromises, when this is zero (the default). A node at the edge of a free area that is narrow beside its map has no room beside it for the name of two lines: past the area is where the room is, and only as far as this allows, never past the edge of the screen and never over a node, a route or another name. Use it where the interface keeps clear of that margin. -pixels— How far, in pixels of a 1080p screen (it scales with the real one), from 0 to 128. -openWays— Whether the names of the open ways (the nodes the traveller may go to) may stand past the area as well; false by default. public void ConfigureFreeRect(Rect normalizedFreeRect)-
Frames the map inside a normalized screen rectangle with a bottom-left origin while the camera keeps the whole screen, so the scene behind the interface stays full-bleed and only the nodes, routes and captions are kept in the free area. -
normalizedFreeRect— A nonempty rectangle within the unit screen. public void ConfigureViewport(Rect normalizedViewport)-
Reserves a normalized viewport for 2D presentation and applies it to the camera. -
normalizedViewport— Viewport rectangle normalized to the range 0..1. public void Confirm()-
Raises the host confirmation command.
public void HandleInput(MapInputFrame input)-
Applies shared pan, zoom, directional focus and submit input. -
input— Input source polled by the host. public void Present(MapExperienceSnapshot snapshot)-
Presents one immutable snapshot and reuses allocated scene objects. -
snapshot— Immutable experience snapshot to present or evaluate. public void SetFocus(StableId nodeId)-
Updates node focus treatment. -
nodeId— Stable identity of the node being entered, focused, or queried. public void Tick(float deltaSeconds)-
One frame of the renderer's own work, as Unity gives it in LateUpdate: the eases step, the camera is framed again, the backdrop follows the camera, and the open ways pulse and the traveller walks. A host or a test that drives the frame itself calls it instead of waiting for Unity; a map that stands still costs this call nothing in managed memory. -
deltaSeconds— Elapsed presentation time in seconds since the previous frame. public bool TryGetScreenPosition(StableId nodeId, out Vector2 screenPosition)-
Projects the transform of a known world node into screen coordinates; the lookup does not test visibility. -
nodeId— Stable identity of the node being entered, focused, or queried. -screenPosition— Screen-space position in pixels. - Returns — True when the node is known and a camera is available for projection; false otherwise. public bool TryHit(Vector2 screenPosition, out StableId nodeId)-
Resolves a screen position to the nearest visible World2D node. -
nodeId— Stable identity of the node being entered, focused, or queried. -screenPosition— Screen-space position in pixels. - Returns — True when a visible node was hit and its ID was written; false otherwise. public bool TryScreenToMap(Vector2 screenPosition, out Vector2 mapPosition)-
Projects a screen point onto the world XY map plane. -
mapPosition— Map-space position produced by the conversion. -screenPosition— Screen-space position in pixels. - Returns — True when the screen point converts to a map position; false otherwise.
World3DEdgeFactory¶
:material-star: Start here
Waybranch.Presentation.World3D · Runtime/Presentation/World3D/World3DMapViews.cs
Creates and pools World3D line routes with a shared local projection scale.
Constructors
public World3DEdgeFactory(float scale)-
Creates a route factory using the supplied layout-to-world scale. -
scale— World-unit scale applied to pooled geometry.
Methods
public IMapEdgeView Create(Transform parent)-
Checks out or creates a pooled route view. -
parent— Transform that owns the created view object. - Returns — The pooled view instance created under the requested parent. public void Dispose()-
Destroys all factory-owned route objects.
public void Release(IMapEdgeView view)-
Returns a route to its pool. -
view— View instance to release or update.
World3DExperienceNodeClick¶
:material-star: Start here
Waybranch.Presentation.World3D · Runtime/Presentation/World3D/World3DExperienceRenderer.cs
Stable node bridge retained for renderer-owned picking metadata.
Properties
public StableId Id-
Stable ID emitted by the common host input bridge.
public World3DExperienceRenderer Owner-
Renderer receiving this node's request.
World3DExperienceRenderer¶
:material-star: Start here
public sealed class World3DExperienceRenderer : MonoBehaviour, IMapExperienceInteractiveRenderer, IMapExperienceCameraRenderer, IMapExperiencePickingRenderer, IMapExperienceLayoutEditingRenderer, IMapExperienceAnimationRenderer, IMapExperienceViewportRenderer, IMapExperienceFreeRectRenderer, IMapExperienceStateSymbols, IMapExperienceTravelRenderer, IMapExperienceTransitions
Waybranch.Presentation.World3D · Runtime/Presentation/World3D/World3DExperienceRenderer.cs
Snapshot-driven World3D adapter. It is useful for preview windows and custom
hosts that do not use MapPresenterBase. Objects are pooled and
positions are projected from snapshot XY to world XZ.
Properties
public bool DrawsStateSymbols-
Whether the presentation currently draws a symbol (triangle, diamond, cross or square) next to each node.
public bool GroundRibbonRoutes-
Whether routes are drawn as ribbons lying on the ground. A call to
ConfigureGroundRoutesdecides; until then the renderer's own setting or the preset's route appearance can enable it. public bool HideLockedRoutes-
Whether routes that are locked are omitted. A call to
ConfigureGroundRoutesdecides; until then the renderer's own setting or the preset's route appearance can enable it. public float MapScale-
Units used to project a normalized snapshot coordinate into XZ.
public bool PreserveAuthoredCameraFraming-
When enabled, camera pose and projection framing are authored by the host and preserved during configuration and viewport changes.
Events
public event Action ConfirmRequested-
Raised when the renderer requests confirmation of the focused node.
public event Action<StableId> NodeRequested-
Raised when the renderer requests a specific node.
Methods
public void Clear()-
Clears the presentation and destroys generated objects and materials.
public void ConfigureBuiltInPawn(bool enabled)-
Shows or hides the built-in capsule pawn that stands on the current node. On by default. -
enabled— True shows the capsule pawn; false hides it, for example when a game actor or an authored traveller stands there. public void ConfigureCamera(Camera camera)-
Configures an explicit preview camera to frame this map in world space. -
camera— Camera used for scene-space projection. public void ConfigureCaptionArea(Renderer area, float marginPixels = 16f)-
Keeps the generated captions and the pawn on the top face of a surface, such as the slate of a board, a margin in screen pixels inside its edges. -
area— Renderer of the surface; null lets them use the whole view. -marginPixels— Distance from the surface's edges, in screen pixels. public void ConfigureCaptionLayout(float gapPixels, bool leaders, bool allowBelow)-
Sets how generated captions sit against their nodes: how far from them, whether a leader joins them, and whether below is allowed. -
gapPixels— Distance in screen pixels between a caption and its node; the default is 6. -leaders— Whether a thin leader joins each caption to its node; on by default. -allowBelow— Whether a caption may sit below its node when that is the closest free place; off by default. When the nearest free places above and below, at the gap or beyond it, are equally close, the caption takes the one below. public void ConfigureFramingRoot(Transform root)-
Names scenery, such as a table, whose renderers are framed with the nodes when a free rectangle is configured. -
root— Root of the scenery, or null to frame only the nodes. public void ConfigureFreeRect(Rect normalizedFreeRect)-
Frames the map inside a normalized screen rectangle with a bottom-left origin while the camera keeps the whole screen, so the scene behind the interface stays full-bleed and only the nodes, routes and captions are kept in the free area. -
normalizedFreeRect— A nonempty rectangle within the unit screen. public void ConfigureGeneratedCaptions(bool enabled)-
Shows or hides the renderer's own text captions (focused, current and available nodes). On by default. -
enabled— True shows the captions; false hides them and stops laying them out. public void ConfigureGroundRoutes(bool ribbon, bool hideLocked, float widthScale = 1f)-
Switches ground ribbon routes and locked-route hiding for this renderer, replacing what the preset asked for. -
ribbon— Draw each route as a flat strip lying on the authored ground, using the route surface for heights. -hideLocked— Omit routes that cannot be used and have not been travelled. -widthScale— Positive multiplier for the ribbon width; one is half a node's width. public void ConfigurePawnOffset(Vector3 localOffset)-
Makes a prefab pawn stand at a fixed offset from the node it belongs to instead of searching for a free place on screen. -
localOffset— Offset in the renderer's local space; the pawn's pivot stands on the table at the node plus this offset. public void ConfigurePawnPrefab(GameObject prefab)-
Prefab that stands on the current node in place of the built-in capsule pawn; null restores the capsule. -
prefab— Prefab whose pivot is the point on the table where it stands. public void ConfigureRouteElevation(bool enabled, float surfaceOffset = .04f)-
Enables route elevation between endpoint node elevations and keeps routes above the authored surface. -
enabled— Whether routes should use interpolated node elevations. -surfaceOffset— Finite non-negative height added above the interpolated surface. public void ConfigureRouteSurface(MapMeshRouteSurface surface)-
Uses an authored mesh sampler for opt-in route elevation. -
surface— Sampler that reports the ground height under a route point, or null to stop using one; the renderer does not own it. public void ConfigureStateSymbols(bool enabled)-
Enables compact geometric state symbols for the World3D presentation. -
enabled— True draws a state symbol beside each node; false, the default, removes them. public void ConfigureViewport(Rect normalizedViewport)-
Reserves a normalized viewport for 3D presentation and applies it to the camera. -
normalizedViewport— Viewport rectangle normalized to the range 0..1. public void Confirm()-
Raises the host confirmation command.
public Mesh GetGroundRouteMesh(StableId edgeId)-
Returns the mesh of a route's ground ribbon, or null when the route has none. -
edgeId— Stable identity of the route. - Returns — The renderer-owned strip mesh in the presentation root's local space; do not modify or destroy it. public void HandleInput(MapInputFrame input)-
Applies shared pan, zoom, directional focus, pointer picking and submit input. -
input— Input source polled by the host. public void Present(MapExperienceSnapshot snapshot)-
Presents one immutable snapshot, reusing existing node and edge objects. -
snapshot— Immutable experience snapshot to present or evaluate. public void SetFocus(StableId nodeId)-
Updates focus treatment without changing graph or gameplay state. -
nodeId— Stable identity of the node being entered, focused, or queried. public void Tick(float deltaSeconds)-
One frame of the renderer's own work, as Unity gives it: the presentation clock and the swell of the open ways (what Update does), then the state symbols, the camera's frame and the caption layout the view needs (what LateUpdate does). A host or a test that drives the frame itself calls it instead of waiting for Unity; a map that stands still costs this call nothing in managed memory. -
deltaSeconds— Elapsed presentation time in seconds since the previous frame. public void TickPresentation(float deltaSeconds)-
Advances the optional presentation-only pawn movement clock. -
deltaSeconds— Elapsed presentation time in seconds since the previous tick. public bool TryGetMarkerStyle(StableId nodeId, out MapMarkerStyle marker)-
Returns the tint, symbol and labels the renderer applied to a node's marker. -
nodeId— Stable identity of the node. -marker— The applied marker style, identical to whatMapExperienceStateTablereturns for the node. - Returns — True when the node has been presented. public bool TryGetMarkerSymbol(StableId nodeId, out MapMarkerSymbol symbol)-
Returns the state symbol drawn for a node when state symbols are enabled. -
nodeId— Stable identity of the node. -symbol— The symbol family currently drawn, or None when no symbol is visible. - Returns — True when a state symbol exists for the node. public bool TryGetScreenPosition(StableId nodeId, out Vector2 screenPosition)-
Projects the transform of a known World3D node into screen coordinates; the lookup does not test visibility. -
nodeId— Stable identity of the node being entered, focused, or queried. -screenPosition— Screen-space position in pixels. - Returns — True when the node is known and a camera is available for projection; false otherwise. public bool TryHit(Vector2 screenPosition, out StableId nodeId)-
Resolves a screen position by testing visible node renderer bounds. -
nodeId— Stable identity of the node being entered, focused, or queried. -screenPosition— Screen-space position in pixels. - Returns — True when a visible node was hit and its ID was written; false otherwise. public bool TryScreenToMap(Vector2 screenPosition, out Vector2 mapPosition)-
Projects a screen point onto the world XZ map plane. -
mapPosition— Map-space position produced by the conversion. -screenPosition— Screen-space position in pixels. - Returns — True when the screen point converts to a map position; false otherwise.
World3DMapEdgeView¶
:material-star: Start here
Waybranch.Presentation.World3D · Runtime/Presentation/World3D/World3DMapViews.cs
Draws an edge as one pooled LineRenderer projected from XY to XZ.
Properties
public StableId EdgeId-
Stable edge identity from the most recent bind.
public Transform Transform-
Transform used by the presenter for parenting and cleanup.
Methods
public void Bind(MapEdgeViewData data)-
Sets route points, colour and fog visibility without reallocating the object. -
data— Compiled view data bound to this view. public void Configure(float scale)-
Sets the XY-to-XZ projection scale used by this view. -
scale— World-unit scale applied to pooled geometry. public void SetActive(bool active)-
Shows or parks this pooled route object. -
active— Whether the view remains active in the scene.
World3DMapNodeView¶
:material-star: Start here
public sealed class World3DMapNodeView : MonoBehaviour, IMapNodeView, IMapNodeHitState, IMapFocusView, IMapStyledView
Waybranch.Presentation.World3D · Runtime/Presentation/World3D/World3DMapViews.cs
Draws one node with a mesh, optional authored prefab, label and stable hit transform.
Properties
public bool IsHitTestVisible-
False for hidden nodes and inactive renderers.
public StableId NodeId-
Stable node identity from the most recent bind.
public Transform Transform-
Transform used by the shared input hit tester.
Methods
public void ApplyStyle(CompiledMapStyle style)-
Copies compiled palette and typography values into the node view, then reapplies state without changing its bound map identity. -
style— Compiled style values applied to the node view. public void Bind(MapNodeViewData data)-
Binds layout, state, text, material colour and XZ projection. -
data— Compiled view data bound to this view. public void SetActive(bool active)-
Shows or parks this pooled object without destroying it. -
active— Whether the view remains active in the scene. public void SetFocused(bool focused)-
Shows the shared keyboard/gamepad focus treatment. -
focused— Whether the node view receives focused presentation. public void TickStyle(float presentationDeltaSeconds)-
Advances no global animation; reserved for style implementations that add motion. -
presentationDeltaSeconds— Elapsed presentation time in seconds since the previous update.
World3DMapPresenter¶
:material-star: Start here
Waybranch.Presentation.World3D · Runtime/Presentation/World3D/World3DMapPresenter.cs
Presents a Waybranch map as pooled scene objects on the XZ plane. Normalized map layout remains unchanged; this presenter only projects the presentation coordinates into world space, so saves and stable IDs are independent from camera and renderer choice.
Properties
public float WorldScale-
Scale used to convert the presenter layout units to world units.
World3DNodeFactory¶
:material-star: Start here
Waybranch.Presentation.World3D · Runtime/Presentation/World3D/World3DMapViews.cs
Creates and pools World3D node views, partitioned by node type and prefab.
Constructors
public World3DNodeFactory(float scale)-
Creates a factory with the supplied layout-to-world scale. -
scale— World-unit scale applied to pooled geometry.
Methods
public IMapNodeView Create(CompiledMapNodeType nodeType, Transform parent)-
Checks out a compatible node, instantiating the authored WorldPrefab when provided. -
nodeType— Compiled node type used to select the view prefab. -parent— Transform that owns the created view object. - Returns — The pooled view instance created under the requested parent. public void Dispose()-
Destroys all factory-owned pooled and active objects.
public void Release(IMapNodeView view)-
Returns a node to its pool without destroying it. -
view— View instance to release or update.
WorldMapEdgeView¶
:material-star: Start here
Waybranch.Presentation.World2D · Runtime/Presentation/World2D/WorldMapViews.cs
Draws one edge between two map nodes as a world-space line, and is the edge view the World2D presentation builds by default.
It uses a LineRenderer rather than the SDF surface its Canvas
counterpart draws with, so it carries colour and fog but not shape, stroke,
glow or dash flow. That is the current limit of World2D styling rather than
a choice about how a world-space map should look; see
Canvas.CanvasMapEdgeView for the styled equivalent.
Properties
public StableId EdgeId-
Gets or sets the stable identifier used for ordinal lookup, fingerprints, and persisted compatibility checks.
public bool IsTransitioning-
Gets whether is Transitioning; the value reflects validated world Map Edge View state.
public Material OwnedMaterial-
Gets owned Material captured by
WorldMapEdgeView; the value is immutable after construction. public IReadOnlyList<NormalizedMapPosition> Points-
Gets or sets a read-only points collection in deterministic order; callers receive no mutation access to the owner's backing state.
public Transform Transform-
Gets transform captured by
WorldMapEdgeView; the value is immutable after construction.
Methods
public void AdvanceTransition(float deltaSeconds)-
Advances an active route fade and applies terminal visibility when interpolation reaches its end. -
deltaSeconds— Elapsed presentation seconds; negative values contribute no progress. public void BeginTransition(MapFogState fromFog, MapFogState toFog, float durationSeconds)-
Starts a route-colour fog fade, keeping a route active until a transition to hidden has finished. -
fromFog— Previous fog state used to calculate the start when no interrupted colour is available. -toFog— Bound destination fog state whose colour and visibility become terminal state. -durationSeconds— Fade duration in seconds; zero or less applies terminal colour and visibility immediately. public void Bind(MapEdgeViewData data)-
Configures the LineRenderer from an edge's resolved path, base colour, stable ID, and fog state. -
data— Edge snapshot containing normalized points, optional presentation points, colour, identity, and fog. public void CancelTransition(bool applyTerminalState)-
Stops route interpolation and optionally snaps colour and activation to the latest bound fog state. -
applyTerminalState— True to apply the destination colour and visibility; false preserves the currently displayed line. public void ConfigureOwnedDefaultMaterial()-
Replaces the configure Owned Default Material settings used by future operations; existing immutable graphs and saves are not rewritten.
public void DisposeOwnedResources()-
Detaches and destroys the fallback line material created by
ConfigureOwnedDefaultMaterial. public void PrepareForBind()-
Captures the LineRenderer's current colour so a rebind can continue an interrupted fog fade.
public void RestoreAfterUnchangedBind()-
Restores the captured on-screen colour when a rebind did not actually change fog state.
public void SetActive(bool active)-
Replaces the set Active settings used by future operations; existing immutable graphs and saves are not rewritten. -
active— True to expose the route GameObject; false to park it while pooled.
WorldMapNodeView¶
:material-star: Start here
public sealed class WorldMapNodeView : MonoBehaviour, IMapNodeView, IMapNodeHitState, IMapNodeTransitionView, IMapFocusView, IMapStyledView, IMapNodeHitArea
Waybranch.Presentation.World2D · Runtime/Presentation/World2D/WorldMapViews.cs
Draws one map node in world space, and is the node view the World2D presentation builds by default. With a style the node is drawn by a styled surface (the same shader and request as the Canvas view) and its sprite carries only the node type's icon; without a style, or without the shader, the sprite draws the whole node.
Use this instead of CanvasMapNodeView when the map lives
in the scene alongside other 2D content - so it sorts, lights and parallaxes
with the rest of the world - rather than on a screen-space overlay. Labels are
drawn with TextMesh plus a shadow so they stay legible over busy art.
Properties
public string DisplayLabel-
The label last bound, already through the localization adapter. Empty when the node type declares none, in which case the label object is deactivated rather than drawn blank.
public MapFogState FogState-
How fog is treating the node. A dimmed node is drawn at three quarters of its colour's alpha; a hidden one has its
SpriteRendererdisabled outright as well as being given zero alpha, so it costs nothing to draw while it is out of sight. public bool IsHitTestVisible-
Whether a click on the node should count. False while fog hides it and false while nothing of it is drawn - neither its sprite nor its styled surface - so a node the player cannot see cannot be selected by accident. It follows the bound fog state, not the fade: a node on its way out stops accepting clicks as soon as it is bound to hidden, while it is still visibly fading away.
public bool IsTransitioning-
Whether a colour cross-fade started by
BeginTransitionis still running. The focus scale is applied instantly and is not counted here. public StableId NodeId-
The node this view currently stands for, taken from the last
Bind. Empty until the first bind, which is what keeps an unbound pooled instance out of hit testing. public NormalizedMapPosition NormalizedPosition-
Where the presenter laid the node out, in normalized layout space. The drawn world position is derived from it, so this is the layout coordinate rather than the world units the node ended up at.
public string Tooltip-
The tooltip last bound, already localized. Kept for a host that draws its own tooltips; this view never renders it.
public Transform Transform-
The node's own transform. Input resolves a click to this node through it, and the factory parents the node by it, so it stays valid for the component's whole lifetime. Its local scale carries the focus treatment, so it is not a reliable place to read the node's size from.
public MapNodeVisualState VisualState-
The traversal state the node was last bound in: hidden, locked, available, current, visited or completed. An undiscovered node is bound as hidden rather than left out of the pass, so this reads hidden for most of a fogged map. It is the destination of a state change rather than what is on screen: the bind runs before the cross-fade, so this already reads the new state while the colour is still travelling towards it.
Methods
public void AdvanceTransition(float deltaSeconds)-
Advances a colour cross-fade in flight, interpolating straight from the captured start colour to the destination. The presenter drives this once a frame on an unscaled delta, so pausing the game does not strand a node mid-fade. A negative delta counts as none, and the frame the fade lands on is also the frame the renderer returns to the visibility the last bind asked for. -
deltaSeconds— Seconds since the previous advance. public void ApplyStyle(CompiledMapStyle style)-
Adopts a compiled style and redraws. Passing null returns the node to the unstyled sprite it drew before styling existed, rather than leaving the last style stuck on it. -
style— Compiled surface and motion tokens to draw, or null to restore the SpriteRenderer fallback. public void BeginTransition(MapNodeVisualState fromVisual, MapFogState fromFog, MapNodeVisualState toVisual, MapFogState toFog, float durationSeconds)-
Cross-fades the node into the state it has just been bound in - its styled surface, or its sprite when it draws without one - taking the label and its shadow along with it. The bind has already applied the destination colour, so the fade works by putting the starting colour back and easing forward from there. A fade interrupted part-way resumes from the colour
PrepareForBindcaptured, which is what stops states that change in quick succession from jumping. The node is drawn for the duration even when the destination is hidden - so it fades out rather than vanishing - and stops being drawn once the fade lands. A duration of zero or less, or two states that resolve to the same colour, applies the destination at once and leavesIsTransitioningfalse. -fromVisual— Prior traversal visual state used when an interrupted on-screen colour was not captured. -fromFog— Prior fog state combined withfromVisualto derive the starting alpha. -toVisual— New traversal visual state already installed by the preceding bind. -toFog— New fog state that determines terminal alpha and renderer visibility. -durationSeconds— Fade time in seconds; zero or less applies the destination immediately. public void Bind(MapNodeViewData data)-
Binds node identity, world position, sprite, visual and fog state, localized text, and styled surface. -
data— Presenter snapshot containing the node, node type, resolved coordinates, size, fog, state, and localized copy. public void CancelTransition(bool applyTerminalState)-
Abandons a cross-fade in flight, before the node is bound again or handed back to its factory. The focus scale is left alone. -
applyTerminalState— True to finish by applying the destination colour and the visibility the last bind asked for, which for a hidden node means switching the renderer off; false to leave the node exactly where the fade stopped, because a new fade is about to start from there. public void PrepareForBind()-
Records the colour on screen right now, immediately before a bind that changes state, so the cross-fade that follows can carry on from a fade already in flight instead of snapping back to the old state. Does nothing on a node that has not been bound yet and so has no renderer resolved.
public void RestoreAfterUnchangedBind()-
Puts back the colour
PrepareForBindcaptured and draws the node again, for a bind that turned out not to change state, so a fade in flight is not cut short. Safe to call with nothing captured and with nothing fading, in which case it only clears the capture. public void SetActive(bool active)-
Shows or hides the node's whole GameObject. This is not how fog is applied: the presenter activates a node after every bind, a fogged one included, and a hidden node is dealt with by disabling its renderer instead. In practice this is the pooling switch, so it has to be reversible - the same instance is handed back out later. -
active— False to park the node, typically because its factory has taken it back. public void SetFocused(bool focused)-
Shows or clears the keyboard and gamepad focus treatment, by drawing the node at 115% of the size it was bound at. The scale is applied at once with no easing, and being told the value it already has re-applies the same scale, so the presenter can drive it on every pass without anything restarting or accumulating. -
focused— True while this is the focused node. public void TickStyle(float presentationDeltaSeconds)-
Advances the current node's pulse. Only the current node pulses, and only when the style asks for it, so a map at rest does nothing here. The phase is supplied by the caller's visual clock, so it never reads a global time source and never affects state. -
presentationDeltaSeconds— Elapsed presentation seconds; zero or less does nothing.
WorldMapPresenter¶
:material-star: Start here
Waybranch.Presentation.World2D · Runtime/Presentation/World2D/WorldMapPresenter.cs
Draws a map as ordinary scene objects rather than UI. Nodes become world-space views pooled per node type, drawn by the styled map surface (a SpriteRenderer carries an icon, or the whole node without a style), routes become LineRenderers drawn from a pool of their own, and both are parented to the node and edge roots, so the map sits in world space alongside your other 2D content and is seen by the same cameras, sorting layers, and post-processing. A node type carrying a world prefab is instantiated instead of the built-in view.
Unlike Waybranch.Presentation.Canvas.CanvasMapPresenter it resizes nothing:
world roots have no rect to fit, so how large the map appears is a matter of the roots' own
scale and the camera. Everything else -- binding to the traversal controller, fog and visual
state, transitions, focus, and styles -- comes from MapPresenterBase.
WorldMapSurface¶
:material-star: Start here
Waybranch.Presentation.World2D · Runtime/Presentation/World2D/WorldMapSurface.cs
Draws one styled map surface in world space, so a World2D map gets the same shapes, gradients, strokes, rings and glow the Canvas presentation has.
It is the world-space counterpart of the Canvas MapSurfaceGraphic and
uses the same shader, the same MapMaterialPool and the same
MapSurfaceRequest, so the two presentations cannot drift apart
in how a node of a given state looks.
A quad rather than a sprite: the shader derives the whole silhouette from a signed distance field and only needs UVs running 0 to 1 across the padded area. Feeding it a sprite would multiply the result by that sprite's own alpha and cut the corners off the shape it just drew.
A colour that changes from frame to frame - a node's fade, the pulse of the
current node - does not ask the pool for another material: the surface keeps
the pooled material of the look it comes to rest in and draws the colours of
the moment over it through a MaterialPropertyBlock on its
renderer, so they allocate nothing once warm. At rest the block is cleared and
surfaces that look the same share their material again.
Properties
public bool HasSurface-
True once a request has been applied and a material resolved.
public MapSurfaceRequest Request-
The parameters last applied: what the surface draws now. Meaningless before the first
Apply. public int SortingOrder-
Draw order for the surface, forwarded to the renderer so a nearer node covers one further away.
Methods
public void Apply(MapSurfaceRequest request, float pixelSize, float worldUnitsPerPixel)-
Builds a padded world-space quad and material from one styled surface request. -
request— Style parameters; its Size and Extent are filled in here. -pixelSize— Node size in presentation pixels, as the style authored it. -worldUnitsPerPixel— Local units of the surface's transform per presentation pixel. The built-in node view passes one over the node size, because its own scale already makes one local unit the node. public void SetDashOffset(float offset)-
Updates only the dash scroll offset, without rebuilding the quad. Kept separate so an animated surface does not rebuild geometry every frame. -
offset— Shader-space dash phase copied into the active surface material. public void SetVisible(bool visible)-
Hides or shows the surface without discarding its material. -
visible— Whether the owned MeshRenderer should draw while retaining its mesh and material.