Editor-mode options
The Debug MD window works outside play mode too, with its own option set - a home for the small editor utilities that usually end up as scattered menu items.
A second registry for the editor
DMDEditor.Options is a separate registry with exactly the
same API as DMD.Options. The Window › Debug MD ›
Panel window shows it while you are out of play mode; the moment you
enter play mode, the window switches to the runtime option set and back
again when play ends. A badge in the panel's header - Edit Mode
or Play Mode - tells you which set you are looking at (a very
narrow window drops it to keep the page buttons whole).
To keep the editor set within reach while playing, turn on
Edit Mode Options In Play Mode.
Because DMDEditor is registered from editor code, these
options can never reach a build. There is no stripping concern and no
release checklist item - the compiler already guarantees it.
DMDEditor set, marked by the Edit Mode badge.Registering
Register from any editor assembly - a folder named
Editor or an editor-only asmdef.
[InitializeOnLoadMethod] is the natural hook; like
DMD, the DMDEditor facade is global, so no
using directive is needed for it:
using UnityEditor;
using UnityEngine;
public static class EditorDebugTools
{
[InitializeOnLoadMethod]
private static void Register()
{
DMDEditor.Options.AddButton("Clear Save Data",
() => PlayerPrefs.DeleteAll());
DMDEditor.Options.AddInfo("Unity",
() => Application.unityVersion);
}
}
What works here
Everything from the options API: toggles, numbers, text, choices, pickers, buttons, and all the layout modifiers - tabs, categories, rows, icons. The panel renders identically; only the option set differs.
Runtime-only concerns simply don't apply out of play mode: there are no touch gestures to configure, and pinning is unavailable - the pinned dock lives on the game's screen overlay, which only exists while playing. Pin affordances are hidden from the window in edit mode, and from the editor set whenever it shows in the play-mode panel.
Good uses
- Scene loaders - a picker over your build scenes, a button that opens the selected one.
- Test-data generators - seed a save file, fill an inventory, reset onboarding flags.
- Project audits - buttons that scan for missing references or oversized textures and log a report.
- At-a-glance info - build target, bundle version, defines, last build time.
Editor options while playing
Off by default, the editor set stays out of the panel while you play. Turn on Edit Mode Options In Play Mode in Window › Debug MD › Settings, under Editor, and the play-mode panel - the game view overlay and the docked window alike - gains one more top-level tab, Edit Mode, after the game's own tabs. It has its own color, tinted even when it is not selected, so it never passes for a game tab.
Under it, the editor set looks exactly as it does out of play mode: its tabs form the next bar down in the main tab color, and its sub tabs follow in the sub tab colors. Search covers both sets, labeling editor results with the Edit Mode path. The setting applies the moment you flip it, mid-play included, and it has no effect in builds, where the editor set does not exist.
The tab's color comes from the theme's
--dmd-color-tab-edit-mode variable - see
Theming.
Which registry to use
DMD.Options is the game's set - it exists at runtime, on
device, in builds. DMDEditor.Options is the editor's set -
it exists only in the editor, out of play mode unless the setting above
brings it in. Register game cheats on DMD and editor tooling
on DMDEditor; an option on the wrong registry shows up in
the wrong panel (or never shows up at all), and that is the only thing
that can go wrong here. Editor options shown while playing run editor
code against a playing game, so keep the ones that touch scenes or
assets in mind: play mode does not undo changes made to assets.