Skip to content
Skills Library
Programming · Analysis

uw-unity-debugging

/uw-unity-debugging

Systematic 4-phase debugging framework for Unity projects with GameDebug wrapper generation. Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes. Triggers on requests like "this doesn't work", "there's a bug", "it crashes when", "fix this error", "why is this happening", "null reference exception", "test is failing", "unexpected behavior", "something broke", or any debugging task. Four-phase framework (gather evidence, isolate, hypothesize, fix) that ensures understanding before attempting solutions.

Licence
MIT
Last repository change
07.07.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 07.07.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Systematic 4-phase debugging framework for Unity projects with GameDebug wrapper generation. Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes. Triggers on requests like "this doesn't work", "there's a bug", "it crashes when", "fix this error", "why is this happening", "null reference exception", "test is failing", "unexpected behavior", "something broke", or any debugging task. Four-phase framework (gather evidence, isolate, hypothesize, fix) that ensures understanding before attempting solutions.

Triggers from the description

this doesnthereit crashes whenfix this errorwhy is this happeningnull reference exceptiontest is failingunexpected behavior
Original author description

Systematic 4-phase debugging framework for Unity projects with GameDebug wrapper generation. Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes. Triggers on requests like "this doesn't work", "there's a bug", "it crashes when", "fix this error", "why is this happening", "null reference exception", "test is failing", "unexpected behavior", "something broke", or any debugging task. Four-phase framework (gather evidence, isolate, hypothesize, fix) that ensures understanding before attempting solutions.

How it works

  1. Before You Start
  2. 4 Phases
  3. GameDebug Wrapper
  4. After Debugging
  5. Rules
Original SKILL.md headings · 107 lines, 568 words
SKILL.md preview
---
name: uw-unity-debugging
description: Systematic 4-phase debugging framework for Unity projects with GameDebug wrapper generation. Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes. Triggers on requests like "this doesn't work", "there's a bug", "it crashes when", "fix this error", "why is this happening", "null reference exception", "test is failing", "unexpected behavior", "something broke", or any debugging task. Four-phase framework (gather evidence, isolate, hypothesize, fix) that ensures understanding before attempting solutions.
---

# Unity Debugging

4-phase debugging framework. Also generates the `GameDebug` wrapper class.

## Before You Start

1. Check if `GameDebug.cs` already exists in the project (search for `class GameDebug`). If not, generate it using the template below during project setup.
2. Read `docs/ProjectConfig.yaml -> mcp.unity_mcp` — if `true`, use `read_console` to read Unity console output.
3. Read `docs/CODING_STANDARDS.md` for async patterns — bugs in async code often involve missing `CancellationToken` or unhandled `OperationCanceledException`.

## 4 Phases

### Phase 1: Gather Evidence
1. Read Unity console (`read_console` via MCP or ask user for errors).
2. Reproduce — exact steps to trigger.
3. Scope — single script, system interaction, or timing?
4. Check `git log -5` for recent changes.

### Phase 2: Isolate
1. Comment out systems to narrow the culprit.
2. Add targeted `GameDebug.Log` at decision points.
3. Check common causes:
   - Execution order (`Awake` vs `Start` vs `OnEnable`)
   - Null reference (destroyed object, unassigned field)
   - Unity API called from background thread
   - State not reset in `OnDisable`/`OnDestroy`
   - Physics in `Update` instead of `FixedUpdate`

### Phase 3: Hypothesize & Test
1. State: *"I believe X happens because Y."*
2. Write a test proving/disproving the hypothesis.
3. If test fails -> back to Phase 2.

### Phase 4: Fix & Verify
1. Implement minimal fix.
2. Re-run the hypothesis test.
3. Run full test suite for regressions.
4. Clean up temp debug logs.
5. Commit: `fix({scope}): {root cause description}`

## GameDebug Wrapper

Generate during project setup. Uses `[Conditional("ENABLE_LOGS")]` so all calls are stripped in release builds. Includes `[CallerFilePath]`, `[CallerMemberName]`, and `[CallerLineNumber]` for automatic context — no need to manually describe where a log came from.

```csharp
using System.Diagnostics;
using System.Runtime.CompilerServices;

public enum LogTopic { General, Gameplay, Audio, UI, Network, Physics, AI }

public static class GameDebug
{
    [Conditional("ENABLE_LOGS")]
    public static void Log(
        string message,
        LogTopic topic = LogTopic.General,
        [CallerFilePath] string file = "",
        [CallerMemberName] string member = "",
        [CallerLineNumber] int line = 0) =>
        UnityEngine.Debug.Log(Format(topic, message, file, member, line));

    [Conditional("ENABLE_LOGS")]
    public static void LogWarning(
        string message,
        LogTopic topic = LogTopic.General,
        [CallerFilePath] string file = "",
        [CallerMemberName] string member = "",
        [CallerLineNumber] int line = 0) =>
        UnityEngine.Debug.LogWarning(Format(topic, message, file, member, line));

    [Conditional("ENABLE_LOGS")]
    public static void LogError(
        string message,
        LogTopic topic = LogTopic.General,
        [CallerFilePath] string file = "",
        [CallerMemberName] string member = "",
        [CallerLineNumber] int line = 0) =>
        UnityEngine.Debug.LogError(Format(topic, message, file, member, line));

    private static string Format(
        LogTopic topic, string msg, string file, string member, int line) {
        var fileName = System.IO.Path.GetFileNameWithoutExtension(file);
        return $"[{topic}] {fileName}.{member}:{line} — {msg}";
    }
}
```

**Usage:** `GameDebug.Log("Player spawned", LogTopic.Gameplay);`
**Output:** `[Gameplay] PlayerController.Start:42 — Player spawned`

Add `ENABLE_LOGS` to Scripting Define Symbols for Development builds only. Customize `LogTopic` enum per project.

## After Debugging

- **Write regression test:** Use `uw-unity-test-runner` to add a test that catches the bug if it reappears.
- **Code review:** Use `uw-code-review` to verify the fix doesn't introduce new issues.
- **Visualize debug data:** Use `uw-unity-editor-tools` to add Gizmos or Handles for spatial debugging (visualize raycast paths, trigger volumes, etc.).

## Rules

- Always follow the 4-phase framework — never jump to a fix before gathering evidence and forming a hypothesis.
- Use `GameDebug` wrapper, never raw `Debug.Log` / `Debug.LogWarning` / `Debug.LogError`.
- Clean up all temporary debug logs after the fix is verified.
- Write a regression test for every bug fix.
- If `ProjectConfig.yaml -> mcp.unity_mcp` is `true`, use `read_console` for console output and `run_tests` to verify fixes.

Versions

The database has no other skills named uw-unity-debugging.

Identical content appears in 1 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 425689938230 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95systematic-debugging
    Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
  • 100systematic-debugging
    Four-phase debugging framework that ensures root cause investigation before attempting fixes. Never jump to solutions. Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
  • 100systematic-debugging
    Use when encountering any bug, test failure, or unexpected behavior. 4-phase root cause investigation — NO fixes without understanding the problem first.
  • 100systematic-debugging
    Use when encountering any bug, test failure, unexpected behavior, or error. Triggers on: "it's broken", "this doesn't work", "I'm getting an error", "fix this bug", any unexpected behavior. Requires finding root cause before attempting fixes. Symptom fixes are failure.
  • 100systematic-debugging
    Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
  • 100systematic-debugging
    Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes. Implements scientific method for debugging with root cause analysis.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.