# 7. Debug Console Pitfalls Part of [[In-Game Debug Console and Cheat Tools]]. Prev: [[6. Worked Example Playtest Build with Cheats and Telemetry]]. > [!warning] Code not compiled > Fixes refer to the scripts in this series, which were not compiled. See the hub for verification status. | Symptom | Cause | Fix | |---|---|---| | Cheats work in the release build | A dev file is missing its `#if UNITY_EDITOR \|\| DEVELOPMENT_BUILD`, or the release profile has Development Build on | Grep for `[DebugCommand` and check each file's first line; build the release profile and run the part 6 section 5 check every milestone | | Release log: "The referenced script on this Behaviour is missing" | A MonoBehaviour/ScriptableObject used in scenes or assets was wrapped in `#if` | Keep scene/asset classes (`DebugWarpPoint`, `DebugSpawnCatalog`) always compiled; wrap only commands and overlays | | `help` lists fewer commands in IL2CPP builds | Managed code stripping removed methods only reached by reflection | `[Preserve]` on command classes and methods, or a `link.xml`; test with stripping set to High | | Console works in Editor but not in a build: no UI at all | `Resources/DevTools` assets missing or misnamed, or Bootstrap returned early | Check the warning `[DevTools] Missing Resources...` in `Player.log`; names are `DevToolsPanelSettings` and `DevConsole` | | UI does not appear when created from code | Runtime-created `PanelRenderer` did not load (hub open question) | Make a `DevTools` prefab with the same components in Boot; Bootstrap skips creation when one exists | | Typing `wasd` in the console moves the player | Gameplay map not disabled, or the game reads `Keyboard.current` directly instead of actions | Use action maps; list every gameplay map in `mapsToDisable`; for direct-device code add `if (DebugConsole.IsOpen) return;` under `#if` | | Esc closes the console **and** opens pause | Both read Esc in the same frame | Pause controller early-outs while `DebugConsole.IsOpen` (part 3 section 5) | | A backquote character appears in the field | Toggle key also produces a character event | Value-changed callback strips `` ` ``; `KeyDownEvent` with `character == '`'` is stopped | | Tab moves focus away instead of completing | Default focus navigation on Tab | Stop the event in `TrickleDown`; if your version still navigates, also handle `NavigationMoveEvent` on the field and refocus via `schedule` (hub open question) | | `timescale 0.25` resets after pausing | Pause menu stores and restores `1` | Store "normal" speed in one place, e.g. a `GameTime.NormalScale` the cheat sets and pause restores to | | Commands run twice or old cheats are still on after Play mode restarts | Enter Play Mode Options with domain reload disabled; statics and events survive | Every static class resets in `SubsystemRegistration` (already in `CheatState`, `CommandRegistry`, `LogCapture`, `SceneCommands`, `DevStartupScript`) | | First console open hitches for 100+ ms | Reflection scan over many assemblies | Scan is lazy and logs its time; skip more assembly prefixes, or move the scan to Boot during a loading screen | | `float` arguments fail on some laptops | Locale with comma decimal separator | Parse with `CultureInfo.InvariantCulture` (`TryFloat`) | | Teleport "snaps back" | `CharacterController` re-applies its old position, or a Rigidbody interpolates | Disable the controller during the move, set `Rigidbody.position` and zero `linearVelocity`, call `Physics.SyncTransforms` | | Camera swoops across the level after `tp` | Follow camera damping | Cinemachine 3: `CinemachineCore.OnTargetObjectWarped(target, delta)` (commented line in `WarpCommands`) | | Heatmaps show deaths in impossible places | Cheated/teleported sessions mixed with clean data | Bridge logs `cheat` rows; sort sessions (part 6) before analysis | | A playtest starts in Level 3 with god mode | A forgotten uncommented line in `DevStartup.txt` | Commit it fully commented; the watermark shows immediately; check the overlay before each tester | | Release build is larger than expected | `Resources/DevTools` assets ship in every build (Resources folders are always included) | Assets are tiny; to remove them entirely, move them out of `Resources` and reference them from a Boot prefab that only exists in a dev scene, or put the tools in a `DEV_TOOLS` assembly plus a dev-only Boot scene | | Students paste "cheat codes" into the player-facing UI | Confusing developer tools with player features | Player cheats/unlocks belong in the real menus ([[Menus, Pause and Settings Flow]], [[Power-Ups, Pickups and Unlockables]]) with design rules; the console is for developers | ## Design pitfalls (Level Up! lens) - **Coaching through cheats.** Rescuing a stuck tester with `tp` hides the level-design bug. Log it (`log stuck at gate`) and fix the level; [[Level Up! (Review)]] Level 13's "if it feels too long, hard, or boring" applies to *being stuck* too. - **Tuning in god mode.** Difficulty tuned with `god` on or `damage 0.5` is not tuned. Turn cheats off for the final pass and compare with [[Game Balance and Dynamic Difficulty]]. - **Overlay as HUD.** If testers read the FPS counter instead of the game, hide it (`fps off`) for first-impression sessions. ## Sources - Scripting symbol reference (6000.5): https://docs.unity3d.com/6000.5/Documentation/Manual/scripting-symbol-reference.html - `PreserveAttribute` (6000.5): https://docs.unity3d.com/6000.5/Documentation/ScriptReference/Scripting.PreserveAttribute.html - Special folder names / Resources (6000.5): https://docs.unity3d.com/6000.5/Documentation/Manual/SpecialFolders.html - Related: [[Profiling and Optimization]], [[Playtest Telemetry and Heatmaps]]