SceneHierarchyWindow

Internal reflection proxy for Unity's private UnityEditor.SceneHierarchyWindow. Provides programmatic control over scene expansion in the Hierarchy panel.

Definition

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

[InternalProxy("UnityEditor.SceneHierarchyWindow", "UnityEditor.CoreModule")]
internal class SceneHierarchyWindow : InternalProxy<SceneHierarchyWindow>

Inheritance: InternalProxy<SceneHierarchyWindow>SceneHierarchyWindow

Remarks

SceneHierarchyWindow wraps Unity's internal SceneHierarchyWindow type using the InternalProxy<T> reflection pattern. This provides type-safe access to internal Unity APIs that are not publicly exposed.

The class is used by EditorSceneManager.RuntimeInitialize() to expand the active scene in the Hierarchy panel when entering play mode, ensuring the developer can see the scene's contents immediately.

All methods operate on the lastInteractedHierarchyWindow — the most recently focused Hierarchy panel. If no Hierarchy window exists, operations are safely no-ops (guarded by null-conditional ?. access).

Properties

lastInteractedHierarchyWindow

public static SceneHierarchyWindow lastInteractedHierarchyWindow { get; }

Gets the most recently interacted Hierarchy window, wrapped as a proxy. Returns null if no Hierarchy window is open.

Constructors

SceneHierarchyWindow

Parameter
Type
Description

target

object

The underlying Unity SceneHierarchyWindow instance

Methods

SetExpanded

Sets whether a scene's hierarchy is expanded (collapsed/expanded) in the Hierarchy panel.

Parameter
Type
Description

scene

Scene

The scene to expand or collapse

expanded

bool

true to expand, false to collapse

SetExpandedRecursive

Sets whether a scene and all its children are expanded recursively.

Parameter
Type
Description

scene

Scene

The scene to expand or collapse recursively

expanded

bool

true to expand all, false to collapse all

GetAllSceneHierarchyWindows

Returns all open Hierarchy windows as proxied instances.

Returns: All open SceneHierarchyWindow instances wrapped as proxies.

Common Pitfalls

circle-exclamation
circle-exclamation

See Also

  • EditorSceneManager — Calls SetExpanded() during play mode initialization

  • InternalProxy<T> — Base class providing cached reflection access to internal Unity types

Last updated