Class ScyllaToolWindowBase
Base class for Scylla editor tool windows built with UI Toolkit. Provides standard USS theme loading, toolbar/status bar setup, and EditorPrefs persistence helpers.
Inheritance
Inherited Members
Namespace: Scylla.Core.Editor
Assembly: ScyllaCore.Editor.dll
Syntax
public abstract class ScyllaToolWindowBase : EditorWindow
Remarks
Use this base class for all Scylla editor tool windows built with UI Toolkit.
Theme loading. The base class automatically loads
ScyllaCommon.uss and the appropriate dark/light theme variant
based on EditorGUIUtility.isProSkin. Subclasses can add their
own USS files via AddStyleSheet(VisualElement, string).
Properties
ContentContainer
The root content container between the toolbar and status bar. Subclasses should add their panel content to this element.
Declaration
protected VisualElement ContentContainer { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
StatusBar
The status bar container at the bottom of the window.
Declaration
protected ScyllaStatusBar StatusBar { get; }
Property Value
| Type | Description |
|---|---|
| ScyllaStatusBar |
Toolbar
The toolbar container at the top of the window. Uses the actual
UnityEditor.UIElements.Toolbar element so that toolbar-specific
children (ToolbarToggle, ToolbarSearchField, ToolbarMenu)
receive the styling Unity expects from a real toolbar ancestor. Subclasses
can add buttons and dropdowns here. Aliased as UIToolbar at the top of
this file to avoid the name collision with the internal UnityEditor.Toolbar.
Declaration
protected Toolbar Toolbar { get; }
Property Value
| Type | Description |
|---|---|
| Toolbar |
Methods
AddStyleSheet(VisualElement, string)
Adds a USS stylesheet from the project's Assets folder to the given element. The path should be relative to Assets/ without extension.
Declaration
protected void AddStyleSheet(VisualElement element, string resourcePath)
Parameters
| Type | Name | Description |
|---|---|---|
| VisualElement | element | The element to attach the stylesheet to. |
| string | resourcePath | Path relative to Assets/, without the .uss extension. For example: "Scylla/Tools/Chroma/Editor/Styles/ChromaWindow" |
BuildHelpBox(string, HelpBoxMessageType)
Builds a UI Toolkit UnityEngine.UIElements.HelpBox with the supplied message and severity.
Declaration
protected static HelpBox BuildHelpBox(string message, HelpBoxMessageType type = HelpBoxMessageType.Info)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message text. |
| HelpBoxMessageType | type | The severity level. |
Returns
| Type | Description |
|---|---|
| HelpBox |
BuildHorizontalLine()
Builds a horizontal separator line styled with the shared .scylla-hr USS class.
Declaration
protected static VisualElement BuildHorizontalLine()
Returns
| Type | Description |
|---|---|
| VisualElement |
BuildLabelValue(string, string)
Builds a two-column label-value row using the shared .scylla-label-value-row
styling. The value column reads as bold, primary-weighted text.
Declaration
protected static VisualElement BuildLabelValue(string label, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | Descriptive label text. |
| string | value | Value text shown in bold. |
Returns
| Type | Description |
|---|---|
| VisualElement |
BuildLabelValueColored(string, string, Color)
Builds a two-column label-value row where the value label is tinted with the supplied color. Use this to convey status (e.g. green for success, red for error).
Declaration
protected static VisualElement BuildLabelValueColored(string label, string value, Color valueColor)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | Descriptive label text. |
| string | value | Value text shown in bold. |
| Color | valueColor | Color applied to the value label. |
Returns
| Type | Description |
|---|---|
| VisualElement |
CreateGUI()
Called when the window is created or after domain reload. Sets up the root visual element hierarchy and loads USS themes.
Declaration
protected virtual void CreateGUI()
LoadPref(string, int)
Loads an integer value from UnityEditor.EditorPrefs using a Scylla-namespaced key.
Declaration
protected int LoadPref(string key, int defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key suffix, prefixed automatically with |
| int | defaultValue | Value returned when the key does not exist. |
Returns
| Type | Description |
|---|---|
| int | The stored value, or |
LoadPref(string, float)
Loads a float value from EditorPrefs using a Scylla-prefixed key.
Declaration
protected float LoadPref(string key, float defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key suffix (will be prefixed with Scylla.Editor.). |
| float | defaultValue | Default value if the key doesn't exist. |
Returns
| Type | Description |
|---|---|
| float | The stored or default value. |
LoadPref(string, string)
Loads a string value from UnityEditor.EditorPrefs using a Scylla-namespaced key.
Declaration
protected string LoadPref(string key, string defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key suffix, prefixed automatically with |
| string | defaultValue | Value returned when the key does not exist. |
Returns
| Type | Description |
|---|---|
| string | The stored value, or |
OnCreateGUI()
Called after the standard layout (toolbar, content, status bar) is created. Subclasses override this to add their panels and controls.
Declaration
protected abstract void OnCreateGUI()
OnPlayModeStateChanged(PlayModeStateChange)
Called when the Unity Editor transitions between Edit mode and Play mode. Override to react to play-mode entry/exit (e.g. refresh runtime panels, start or stop polling schedulers, swap UI content).
Declaration
protected virtual void OnPlayModeStateChanged(PlayModeStateChange state)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayModeStateChange | state | The new play mode state. |
OnWindowDestroyed()
Called when the editor window is destroyed (closed by the user, or programmatically
via UnityEditor.EditorWindow.Close()). Subclasses override to release resources or
clear persistent state. The base implementation is empty. Note that domain reload
triggers OnDisable but not OnDestroy; this hook fires only on actual
window destruction.
Declaration
protected virtual void OnWindowDestroyed()
SavePref(string, int)
Saves an integer value to UnityEditor.EditorPrefs using a Scylla-namespaced key.
Declaration
protected void SavePref(string key, int value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key suffix, prefixed automatically with |
| int | value | The integer value to store. |
SavePref(string, float)
Saves a float value to EditorPrefs using a Scylla-prefixed key.
Declaration
protected void SavePref(string key, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key suffix (will be prefixed with Scylla.Editor.). |
| float | value | The value to save. |
SavePref(string, string)
Saves a string value to UnityEditor.EditorPrefs using a Scylla-namespaced key.
Declaration
protected void SavePref(string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key suffix, prefixed automatically with |
| string | value | The string value to store. |