Stripping from builds

Release builds leave Debug MD out on their own - panel, console, profiler, assets - while every DMD call in your game keeps compiling exactly as written. Nothing to set up before you ship.

When Debug MD is in a build

WhereDebug MD
The editor, in and out of play modeAlways in.
A build with Development Build tickedIn.
Any other buildOut, unless the build defines DEBUGMD_ENABLED.

It is the same rule everywhere: the runtime assembly's define constraint is UNITY_EDITOR || DEVELOPMENT_BUILD || DEBUGMD_ENABLED, and the build step that adds Debug MD's assets follows it. The default is the safe one: a store build made in a hurry has no cheats in it.

How it works

Debug MD is split into a small always-present API assembly - the DMD facade and the option types - and the runtime that does the actual work. The API assembly never references the runtime directly; the runtime attaches itself on startup. In a build without Debug MD the runtime (and its assets) are not there, leaving the API assembly with nothing attached:

  • Add and the AddToggle-style shorthands register nothing. They still return their option and handle objects, so chained calls are safe; the handle reports IsRegistered == false.
  • Init, ShowPanel, HidePanel, TogglePanel do nothing; IsInitialized, IsPanelVisible and IsPointerOverPanel are always false.
  • PanelVisibilityChanged never fires. Your getters and setters are never invoked.

The consequence: registration and panel code needs no #if guards. Registration calls, panel toggles, theme calls - leave them in place; in a build without Debug MD they compile and go quiet. Editor-mode options registered through DMDEditor are editor-only and need no guards either.

Assets go too

A build without Debug MD carries none of its assets. The package has no Resources folder - Unity ships a Resources folder whole whatever the code does. Instead, the panel's assets and your settings asset reach a build as preloaded assets, added at build time and only for builds that keep Debug MD. Nothing is added to your Player Settings permanently.

Keeping it in a non-development build

Some builds need the panel without being development builds - a QA build profiled at release speed, a review build for a publisher. Add DEBUGMD_ENABLED to Project Settings › Player › Other Settings › Scripting Define Symbols for that platform, to a Unity 6 build profile's own defines, or set it from a build script:

Editor/QABuild.cs
using UnityEditor;
using UnityEditor.Build;

// In a build script: keep Debug MD in a non-development QA build.
PlayerSettings.SetScriptingDefineSymbols(
    NamedBuildTarget.Android,
    "DEBUGMD_ENABLED");

Remember to take it out again before the store build - or keep it in a build profile of its own, so the release profile never sees it.

What ships, what doesn't

In a build without Debug MDResult
Panel & widgetsNot in the build. No overlay is created, no gesture detection runs.
Console captureNot in the build. Log hooks are never installed.
ProfilerNot in the build.
UI assets, themes, fontsNot in the build.
API assemblyShips - a few kilobytes of no-op facade so your calls link.
Your registration codeShips as written, executes as no-ops.

After your first release build, open Unity's build report and search for Debug MD entries - seeing only the API assembly is the expected result, and it's worth confirming once per project rather than trusting the documentation.

IL2CPP and managed stripping

Leaving Debug MD out is for release. In the builds where it stays in, it is safe under IL2CPP with Managed Stripping Level set to High: options bind through the delegates you pass at registration, so nothing depends on reflection metadata surviving the linker. There are no link.xml entries to maintain and no attribute scanning at runtime.