API: IWorldGraph, WorldGraph and EditorGraph
GraphEngine: shared base
Both WorldGraph and EditorGraph inherit from the generic base GraphEngine<TSceneData, TPortData, TConnectionData, TTransitionData>. Every method from the IWorldGraph section (below) is therefore also available on EditorGraph — just with different generic types. EditorGraph adds editor-specific helpers on top.
IWorldGraph (runtime)
IWorldGraph is the clean runtime graph, exposing only the current methods for working with the graph. Deprecated methods that in 1.2 were called through WorldGraphContainer (and ContainerEditorData in the editor) are marked [Obsolete] and kept on those types — they are not part of the IWorldGraph contract. Obtain it via ITransitionManager.Graph.
| Method | Purpose |
|---|---|
IReadOnlyList<SceneRuntimeData> GetScenesData() | All scenes in the graph. |
IReadOnlyList<ConnectionRuntimeData> GetEdgesData() | All connections in the graph. |
bool TryGetPortData(string guid, out PortRuntimeData data) | Port data. |
bool TryGetOppositePassageGuid(string guid, out string opposite) | The Guid of the opposite port along a connection. |
bool TryGetSceneDataByPortGuid(string guid, out SceneRuntimeData data) | The scene the port belongs to. |
bool TryGetSceneDataByBuildIndex(int buildIndex, out SceneRuntimeData data) | Scene by Build Index. |
bool TryGetSceneDataByAddress(string address, out SceneRuntimeData data) | Scene by Addressable address (only under WGE_ADDRESSABLES — see Addressables support). |
bool TryGetPassageTransitionData(string currentPortGuid, out RuntimeTransitionData data) | Transition data for GoFromAsync (following a graph connection). |
RuntimeTransitionData GetTeleportTransitionData(string currentPortGuid, string targetPortGuid) | Transition data for GoToAsync (teleport between arbitrary ports). |
List<SceneRuntimeData> GetNeighboursData(SceneRuntimeData sceneData, bool ignoreShortcuts) | Neighbouring scenes reachable through the given scene's ports. |
List<SceneRuntimeData> GetNeighboursData(IEnumerable<string> passageGuids, bool ignoreShortcuts) | Neighbouring scenes reachable through an arbitrary set of port Guids. |
bool CanPassTransition(string guid, bool ignoreShortcuts) | Whether the given port can be traversed. |
bool CanPassTransition(string guid, bool ignoreShortcuts, out TransitionPassStatusType status) | Whether the port can be traversed, with a detailed status (Allowed, BlockedByDirection, BlockedByShortcut, etc.). |
bool IsShortcutOrigin(string guid), IsShortcutDestination(string guid) | Whether the port sits on the origin/destination side of a shortcut connection. |
bool IsOneWayOrigin(string guid), IsOneWayDestination(string guid) | Whether the port sits on the origin/destination side of a one-way connection. |
WorldGraph (runtime)
WorldGraph is the concrete implementation of IWorldGraph. Its public surface is identical to the interface (table above) — WorldGraph itself has no extra or deprecated methods. Obtain it via WorldGraphContainer.GetWorldGraph() or WGEProjectConfig.Instance.GetWorldGraph().
The deprecated Get methods (which returned default when data was missing) were replaced by TryGet counterparts. The [Obsolete] versions are kept not on WorldGraph but on WorldGraphContainer (runtime) and ContainerEditorData (editor) for smooth migration — see Replacing Get methods with TryGet.
EditorGraph (editor)
Includes every WorldGraph method (with the types SceneNodeData/PortData/EdgeData/EditorTransitionData), plus editor-specific helpers:
| Method | Purpose |
|---|---|
IEnumerable<(string Guid, string Path)> GetAllPortsDropdownData() | Every port in the graph as "NodeName/PortName" → Guid — for a PortsDropdown that picks among all ports. |
IEnumerable<(string Guid, string Name)> GetPortsDropdownData(string scenePath) | Ports for a specific scene — for a PortsDropdown that picks among a single scene's ports. |
bool TryGetSceneDataBySceneAssetGuid(string sceneAssetGuid, out SceneNodeData data) | Scene by asset Guid. |
bool TryGetSceneDataByPath(string path, out SceneNodeData data) | Scene by .unity asset path. |
In editor code you can obtain EditorGraph via RefreshContext.EditorGraph (from Refresh(RefreshContext)) or WorldGraphContainer.EditorGraph. At runtime the graph is exposed as IWorldGraph via ITransitionManager.Graph; the concrete implementation is WorldGraph (e.g. from WGEProjectConfig.Instance.GetWorldGraph()).