← ClaudeAtlas

unity-debug-runtimelisted

Work out why a Unity game is running wrong — it crashes, it throws, a reference is null in play mode but looks fine in the inspector, it stutters, the frame rate sags — on a project with no automated tests to tell you. Evidence before theories: reproduce it on demand, read the right log, read the stack trace properly, narrow it, confirm the fix killed it. Use when: "why does my game crash", "NullReferenceException", "MissingReferenceException", "the referenced script on this Behaviour is missing", "my reference is null at runtime", "the game is stuttering", "frame rate drops after a while", "GC spike", "it works in the editor but not in the build", "where is the Unity log", "how do I profile this", "when did this break", or "/unity-debug-runtime".
Xenoneqq/unity-ai-skills · ★ 1 · Code & Development · score 74
Install: claude install-skill Xenoneqq/unity-ai-skills
# Debugging a Unity game at runtime **Evidence before theories.** A Unity bug reads like three plausible stories at once, and reading code picks whichever one you thought of first. Get a fact, then pick. Four moves, in this order: **reproduce → locate → narrow → confirm.** Skip the reproduce and you cannot tell a fix from a coincidence. Skip the confirm and you never find out which it was. This is the half [`unity-agent-worker`](../unity-agent-worker/references/verification.md) leaves open: its ladder says *whether* something is broken, this says *why*. What the code should look like afterwards is [`unity-coding-habits`](../unity-coding-habits/SKILL.md). ## 1. Name the symptom before touching anything Profiling a logic bug and reading stack traces for a frame-rate bug both find nothing. | Shape | Looks like | Start at | |---|---|---| | It throws | Red in the console, a stack trace | §3, §4 | | It misbehaves quietly | Wrong value, nothing happens, nothing logged | §2, then §5 | | It is slow | Low frame rate, stutter, climbing memory | §6 | | It dies | Process gone, no managed trace | §3 — the crash file, not the console | ## 2. Make it reproduce, before reading any code Write the steps down and run them three times. Three out of three is a bug; one out of three is an observation, and the next move is to make it deterministic, not to start guessing. - **Seed the randomness.** `Random.InitState(seed)` at startup; save and restore `Random.state` around anything that mu