Class EditorOverlay
The in-game editor: an EditorFrame over the game's UI, an Outline and Toolbox dock on the left, a Properties dock on the right and a command bar on top, shown and hidden with one key.
public sealed class EditorOverlay : IDisposable
- Inheritance
-
EditorOverlay
- Implements
- Inherited Members
- Extension Methods
Remarks
Using it in your game:
#if DEBUG
DesignSession design = DesignSession.Attach(configuration); // before loading any screen
if (DesignSession.FindSourceRoot("MyGame.csproj", "Assets/UI") is { } root)
design.UseSourceRoot(root);
EditorOverlay overlay = EditorOverlay.Attach(canvas, design); // F4 toggles it
#endif
Reference IcyUI.Design from the game only in Debug builds, so release builds don't carry it:
<ProjectReference Include="..\IcyUI.Design\IcyUI.Design.csproj" Condition="'$(Configuration)' == 'Debug'" />.
- The toggle key is registered without handling the gesture, so a game's own command for the same key still runs.
- Hiding detaches the frame, the docks and the bar. The DesignSession keeps tracking, and every document keeps its edits and undo history.
- The docks sit above the frame's capture layer, so clicking them never selects the game's elements. Each dock collapses to a thin strip so the game stays visible.
- A canvas takes one editor at a time: while another one is attached (an EditorWorkspace, say), Show() stays hidden and LastShowError says why.
Properties
IsShown
Gets a value indicating whether the editor is shown.
public bool IsShown { get; }
Property Value
LastShowError
public string? LastShowError { get; }
Property Value
Session
Gets the editor session while the overlay is shown, or null.
public EditorSession? Session { get; }
Property Value
Methods
Attach(Canvas, DesignSession, EditorOverlayOptions?)
Prepares an editor overlay for canvas, hidden until Show() or the toggle key.
public static EditorOverlay Attach(Canvas canvas, DesignSession design, EditorOverlayOptions? options = null)
Parameters
canvasCanvasThe game's canvas.
designDesignSessionThe session tracking the game's screens.
optionsEditorOverlayOptionsThe options, or null for the defaults.
Returns
- EditorOverlay
The overlay; dispose it to hide it and release the toggle key.
Exceptions
- ArgumentNullException
canvasordesignis null.
Dispose()
Hides the editor and releases the toggle key.
public void Dispose()
Hide()
Hides the editor: detaches the frame, the docks and the bar. Edits and undo history stay with the documents.
public void Hide()
Show()
Shows the editor. Does nothing when it's already shown; stays hidden, with LastShowError set, when another editor owns the canvas or the scope isn't on it.
public void Show()
Exceptions
- ObjectDisposedException
The overlay was disposed.
Toggle()
Shows the editor when it's hidden, and hides it when it's shown.
public void Toggle()
Events
IsShownChanged
Occurs when IsShown changed.
public event EventHandler? IsShownChanged