OpenSceneToolbarPopup

EditorWindow that displays as a dropdown popup with two ListView panels — bookmarked scenes and all other scenes. Supports bookmark management (add/remove), edit mode toggling, left-click to open a scene, and right-click context menu for opening with dependencies or additively. Bookmarks are persisted via EditorPrefs.

Definition

Namespace: Paragon.Editor.OpenSceneToolbar Assembly: Paragon.Editor.dll

public class OpenSceneToolbarPopup : EditorWindow

Inheritance: EditorWindow → OpenSceneToolbarPopup

Remarks

The popup is shown via ShowAsDropDown() positioned relative to the toolbar button. It dynamically resizes based on the number of visible items, capped at max_list_size (5) items per list. The window uses two UXML template assets: one for the main layout and one for individual scene list items.

Scene Loading

Scenes are loaded from AssetDatabase on each popup open. The Paragon.Core.SceneManagement.Scene wrapper provides Name, GUID, and Path properties. Opening a scene prompts to save modified scenes first via EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo().

Input Handling

Input
Action

Left-click scene

Opens scene in single mode (replaces current)

Right-click scene

Shows context menu: Open with Dependencies, Open Additive, Open Additive with Dependencies

Click "+" button

Adds scene to bookmarks (edit mode, scene list)

Click "-" button

Removes scene from bookmarks (edit mode, bookmark list)

Click gear icon

Toggles edit mode on/off

Fields

Field
Type
Access
Description

visualTreeAsset

VisualTreeAsset

private

Main popup UXML template

sceneListItemTreeAsset

VisualTreeAsset

private

Per-item UXML template for scene entries

bookmarkedScenes

List<Scene>

private

Currently bookmarked scenes

otherScenes

List<Scene>

private

All non-bookmarked scenes (sorted by name)

isEditModeActive

bool

private

Whether edit mode is active (shows +/- buttons and scene list)

Constants

Constant
Value
Description

width

135

Fixed popup width in pixels

item_height

18

Height of each scene list item in pixels

max_list_size

5

Maximum visible items per list

Static Methods

ToggleDropdown

Creates and shows the popup as a dropdown below the specified button rect.

Parameter
Type
Description

buttonRect

Rect

The toolbar button's world-space bounds (used for positioning)

Persistence

Key
Storage
Format

"OpenSceneToolbarBookmarks"

EditorPrefs

Comma-separated scene GUIDs

Bookmarks are loaded on each popup open (LoadPrefs) and saved when the popup closes (OnDestroySavePrefs). The ResetPrefs method clears all bookmarks.

Common Pitfalls

circle-exclamation
circle-info

Scenes are loaded fresh each time. LoadPrefs() queries AssetDatabase.FindAssets("t:Scene") on every popup open. Deleted scenes are gracefully filtered out — their GUIDs won't match any loaded asset.

See Also

Last updated