SceneGraphEditor

Custom OdinEditor for the SceneGraph ScriptableObject. Provides the UI for managing scenes and dependencies in Unity's Project Settings, with circular dependency detection and automatic Build Settings synchronization.

Definition

Namespace: Paragon.Core.SceneManagement.Editor Assembly: Paragon.Editor.dll

[CustomEditor(typeof(SceneGraph))]
internal class SceneGraphEditor : OdinEditor

Inheritance: OdinEditorSceneGraphEditor

Remarks

SceneGraphEditor is the primary UI for the Scene Graph system. It is registered as both a [CustomEditor] and a [SettingsProvider] (at Project/Scene Graph), making the graph accessible from Unity's Project Settings window.

Key behaviors:

  • Scene list rendering — Draws the scenes property with a custom "Add" button that opens a SceneSelectMenu popup

  • Circular dependency detection — On every OnInspectorGUI() repaint, validates the graph for cycles using DFS. If a cycle is found, displays an error with the dependency chain (e.g., A → B → C → A)

  • Auto Build Settings sync — Compares the graph's scene list with EditorBuildSettings.scenes on every repaint. If they differ (and no circular dependency exists), auto-saves and syncs

  • Safety on close — If the editor is closed with an unresolved circular dependency, EditorBuildSettings.scenes is cleared to prevent broken builds

Odin Integration

An inner AttributeProcessor adds [DoNotDrawAsReference] and [ListDrawerSettings] to the scenes member, configuring:

  • ShowFoldout = false — No collapsible header for the scenes list

  • HideRemoveButton = true — Remove is handled by SceneNodeDrawer's custom X button

Methods

OnInspectorGUI

Main draw method. Renders the scene list, checks for circular dependencies, and auto-syncs Build Settings.

CreateSceneGraphProvider

Registers the SceneGraph as a Project Settings panel at Project/Scene Graph.

Returns: An AssetSettingsProvider wrapping the SceneGraph singleton.

Common Pitfalls

circle-exclamation
circle-exclamation
circle-info

Accessed via Project Settings Open Edit > Project Settings > Scene Graph to access the editor. It's registered via the [SettingsProvider] attribute on CreateSceneGraphProvider().

See Also

Last updated