Opening & configuring
Every way to open the panel, and every setting that changes how it behaves - including overriding settings on the device itself.
From code
DMD.ShowPanel(); // open
DMD.HidePanel(); // close
DMD.TogglePanel(); // open if closed, close if open
if (DMD.IsPanelVisible) { /* ... */ }
Starting it yourself
By default Debug MD starts on its own. If your game would rather
decide if and when the debug tooling exists - typically behind its own
debug flag, next to other tools it boots - turn off
Auto Load and call DMD.Init()
from your startup code:
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
private static void InitDebugTools()
{
#if DEBUG
DMD.Init();
#endif
}
DMD.Init()is safe to call more than once, and does nothing extra when Auto Load already started Debug MD.- It can be called as early as
AfterAssembliesLoaded. Before the first scene has loaded the start is queued, and Debug MD comes up right after the scene loads - the same moment Auto Load uses.DMD.IsInitializedturns true at that point. DMD.ShowPanel()andDMD.TogglePanel()also start Debug MD if it isn't running yet, so a game that only ever opens the panel from its own button needs noInitcall at all.- Until Debug MD is started there is no trigger gesture, no keyboard shortcut and no pinned widgets. Options can be registered at any time before that; they appear once it starts.
- Like the rest of
DMD, it does nothing in batch mode or when Debug MD is stripped, so the#ifabove is your own choice, not a requirement.
The PanelVisibilityChanged event fires on every open and
close. Its canonical use is muting game input while the panel is up, so
taps on cheats don't also fire your gameplay:
DMD.PanelVisibilityChanged += visible =>
_input.SetBlocked(visible);
The open panel already stops input from reaching the UI beneath it -
lower UI Toolkit panels, and uGUI through the EventSystem. What it cannot
stop is game code that reads input directly. For that,
DMD.IsPointerOverPanel(screenPosition) answers whether a
pointer position lands on Debug MD: the open panel, or a pinned widget at
any time. Pass the position as the input systems report it
(Input.mousePosition, Pointer.current.position,
a touch position - origin bottom-left) and skip the click when it is
true:
if (Input.GetMouseButtonDown(0) &&
!DMD.IsPointerOverPanel(Input.mousePosition))
{
MoveTo(Input.mousePosition);
}
DMD.DestroyPanel() tears down the panel's visual tree to
reclaim its memory. Registered options are unaffected, the panel rebuilds
itself the next time it opens, and pinned
widgets stay on screen. The Destroy On Close setting below
does the same automatically after every close.
Touch gestures
The trigger gesture is a setting (and a per-device override). Corner gestures use the configured corner - a generous hot-zone sized from the safe area, so notches and camera cutouts never eat it.
| Mode | Gesture |
|---|---|
TripleTapCorner | Tap the corner three times. Taps chain with generous timing, and each one flashes so you can see the count registering. |
ThreeFingerTap | Tap anywhere with three fingers at once. |
TapAndHoldCorner | Press and hold the corner for about half a second; a progress ring fills while you hold. |
TripleTapOrHoldCorner | Default (top-left corner). Either of the two corner gestures opens the panel, so whichever one a tester tries first works. |
Disabled | No touch trigger. The keyboard
shortcut and the DMD calls still work. |
Doing the wrong corner gesture - holding in triple-tap mode, or tapping three times in hold mode - pops a short hint telling you which gesture this build uses. While the panel is open, gesture detection pauses entirely; it resumes when the panel closes.
Keyboard
On desktop platforms - and in editor play mode - F1 toggles the panel by default; the key is a setting. Esc closes one layer at a time: an open picker or the PIN prompt first, then the panel. While a text field is being edited, Esc cancels the edit instead, and button hotkeys stay quiet.
The editor window
Window › Debug MD › Panel opens the same panel as a dockable editor window - identical rendering, identical options, usable through play mode without covering the Game view. Out of play mode the window shows editor-mode options instead.
On a narrow panel - a small docked window, a phone in portrait - the header keeps its page buttons whole and lets the title side give way: first the Debug MD wordmark hides, then the mode badge. The logo always stays.
Settings
Window › Debug MD › Settings creates the single settings
asset on demand and edits it in place. With no asset, the defaults below
apply - that is the zero-setup path. From code, every resolved value
except the password is readable through
DebugMDSettings.Instance (see the
reference).
The asset is created at Assets/Settings/DebugMDSettings.asset
and can be moved to any folder - except a Resources folder.
Unity ships a Resources folder whole, so a settings asset kept there would
end up even in builds that strip Debug MD.
Builds pick the asset up on their own; it needs no particular location.
| Setting | Default | What it does |
|---|---|---|
| Auto Load | on | Creates the panel automatically
on startup, no scene setup. Turn off to start Debug MD only when
your own code calls DMD.Init() - see
Starting it yourself. |
| Destroy On Close | off | Destroys the panel UI each time it closes, freeing its memory until reopened - for memory-sensitive device testing. |
| Show Cursor While Open | on | Shows and unlocks the cursor while the panel is open, restoring the game's own cursor state on close - see While the panel is open. |
| Trigger Mode | Triple-tap or hold corner | The touch gesture that opens the panel. |
| Trigger Corner | Top left | Corner used by the corner gestures, in safe-area coordinates. |
| Keyboard Shortcut | F1 | Desktop toggle key. |
| Require Password | off | Gate the panel behind a password - see PIN gate. |
| Password | empty | The password the gate asks for. The gate is inactive while this is empty. |
| Pinned Snap Tolerance | 24 px | Distance at which the pinned dock snaps to a screen edge while dragging. |
| Pinned Opacity | 75% | How opaque the pinned widgets' background is (10-100%). Their text and controls stay solid. |
| Step Buttons | on | Show the step arrows either side of a number option's value. Individual options override this - see Step arrows. |
| Sub Tab Markers | on | Mark tabs that hold sub tabs with a small down chevron. |
| Edit Mode Options In Play Mode | off | Editor only: while playing, show the editor-mode options in the panel too, under an Edit Mode tab of their own. |
| Poll Frequency | Medium | How often visible widgets re-read your getters: Fast = 20/s, Medium = 10/s, Slow = 4/s. |
| Disable Profiler | off | Turns the profiler off: no per-frame sampling and no pinnable mini profiler. The profiler button stays, dimmed, and explains itself when tapped. No device override. |
| Console Max Entries | 10,000 | How many log entries the console retains (clamped 256-200,000). An override applies on the next launch. |
| Error Signal | on | Pulse a red exclamation mark in the trigger corner when an error or exception is logged - see the error signal. |
| Warning Signal | off | Pulse an amber warning mark in the same corner when a warning is logged. An error takes over at once; a warning during an error is dropped. |
| Error Signal Seconds | 4 | How long the error (and warning) signal pulses, 1-30. A further log while it pulses starts the time over. |
| Additional Themes | empty | Your own theme stylesheets, offered by the theme picker beside the built-in ones. |
| Panel Sorting Order | 10,000 | Where the panel sits against your own UI Toolkit panels and uGUI canvases: the higher value draws on top and takes input first. The default is well above what games normally use; if your own UI is deliberately placed higher and still covers the panel, raise it (uGUI canvases go up to 32,767, UI Toolkit panels have no cap). Applied when the panel starts. IMGUI always draws over everything. |
| Panel Opacity | 75% | How opaque the open panel's background is (10-100%), so the game can show through. Text, controls and the header stay solid. The editor window ignores it. |
| Panel Settings Override | empty | A PanelSettings asset replacing the built-in one, for a different theme, font or scaling. Panel Sorting Order still applies to it. |
While the panel is open
Debug MD changes exactly one thing about a running game while its panel is up: it frees the mouse cursor. Everything else a game might want while a debug panel is open - pausing, muting, stopping a tween engine - stays your decision, and two events are where you make it.
Show Cursor While Open is on by default, and it is a
setting rather than a rule because it is the one behaviour the panel
cannot leave alone. A game that hides or locks the cursor - every
first-person controller does - is otherwise impossible to use a panel in:
the pointer stays captured and centered, and no option can be clicked.
While the panel is open Debug MD shows and unlocks the cursor,
re-asserting it after your scripts have run each frame so a controller
that re-locks in Update cannot take it back mid-session. On
close, the previous Cursor.visible and
Cursor.lockState are restored exactly as they were. The
setting is overridable per device.
DMD.PanelOpened and DMD.PanelClosed are the
hooks for the rest. Pausing lives here rather than in a setting on
purpose: what "paused" means is specific to a game - a time scale, a
tween engine, an audio bus, a state machine that must not be re-entered -
and a debug panel guessing at it causes more trouble than it saves:
private float _timeScaleBeforePanel;
private void OnEnable()
{
DMD.PanelOpened += OnPanelOpened;
DMD.PanelClosed += OnPanelClosed;
}
private void OnPanelOpened()
{
_timeScaleBeforePanel = Time.timeScale;
Time.timeScale = 0f;
AudioListener.pause = true;
}
private void OnPanelClosed()
{
Time.timeScale = _timeScaleBeforePanel;
AudioListener.pause = false;
}
Pausing this way is safe with the panel itself: nothing in Debug MD
runs on scaled time. The trigger gestures, the widget polling, the
profiler graph and every animation use unscaled time, so the panel stays
fully usable - and the profiler keeps drawing - at
Time.timeScale = 0.
- The two events fire alongside
DMD.PanelVisibilityChanged, which carries the same information as abool. Use whichever reads better; they are the same moment. - Every open pairs with exactly one close, including when the panel is
destroyed while open through
DMD.DestroyPanel()or the Destroy On Close setting. - Handlers are called for the on-device panel. The dockable editor window is a separate surface and does not raise them.
PIN gate
With Require Password on and a password set, the first attempt to
open the panel in a session shows a password prompt - gesture, shortcut
and DMD.ShowPanel() all funnel through it. Unlocking lasts
for the rest of the app session; losing and regaining focus does not
re-lock. While locked, pinned widgets stay
hidden and button hotkeys are inert, so nothing leaks around the
gate.
Per-device overrides
The panel's About page has a Device Settings section that overrides part of the settings asset on that device only - useful when one tester needs a different gesture or a bigger console without cutting a new build. Overridable there: trigger mode, trigger corner, keyboard shortcut, poll frequency, destroy-on-close, show-cursor-while-open, console capacity, the error and warning signals and how long they pulse, the step buttons (the number arrows), the sub tab markers and the panel and pinned opacity.
- An option whose effective value differs from the build's setting renders bold with a star, so overridden devices are recognizable at a glance.
- Overrides persist on the device across sessions and win over the settings asset until cleared with Reset to Build Defaults on the same page.
- In the editor the overrides live in the editor's own PlayerPrefs, so they mask the settings asset there too. The settings window says so: while any are set, a warning at its top names the masked settings, with a Clear Device Overrides button.
- Auto Load and the password can never be overridden from the device - the panel does not let a device reconfigure its own gate or lock itself out of loading.