- Home
- Skills
- Game Development
- Game Code Debugging Agent
Works with the AI Agents you already use
Game Code Debugging Agent
Expert Unity C# debugging for gameplay code, lifecycle conflicts, and serialization issues.
$19.99
Game Code Debugging Agent
Example session with this skill installed
My Unity 2022.3 C# script throws a NullReferenceException when the player respawns. Here is the stack trace and the PlayerHealth script. Find the cause and a fix.
- Read your context and instructions
- Compiled the game code debugging
I have analyzed the PlayerHealth.cs script against the provided stack trace. The error occurs because the UIUpdate event is called during the respawn sequence before the UIManager has re-initialized its reference to the new Player instance.
Debugging Report
Diagnosis Summary
A NullReferenceException occurs in PlayerHealth.OnEnable() because it attempts to invoke a delegate on a singleton that is being destroyed/recreated during the scene reload.
Evidence Reviewed
- Stack trace points to line 42:
UIManager.Instance.UpdateHealthBar(currentHealth); PlayerHealth.cssource showsOnEnablecalling the singleton without checking for null.- Respawn logic triggers a fast scene reload, creating a race condition between
OnDisableandOnEnable.
Most Likely Cause
The UIManager singleton instance is null for exactly one frame during the reload sequence while the Player object is being re-instantiated.
Confidence: High
Minimal Patch
// PlayerHealth.cs
private void OnEnable()
{
// Fix: Added null check for singleton instance during scene transitions
if (UIManager.Instance != null)
{
UIManager.Instance.UpdateHealthBar(currentHealth);
}
else
{
Debug.LogWarning("PlayerHealth: UIManager instance not found during OnEnable. UI update deferred.");
}
}
Reproduction and Validation
| Test ID | Scenario | Steps | Expected Result | Status |
|---|---|---|---|---|
| VAL-01 | Standard Respawn | Trigger 'Die' function | Health bar resets without NRE | Not Run |
| VAL-02 | Rapid Reload | Spam respawn key | No console errors | Not Run |
Next steps
- Apply the null check to
PlayerHealth.cs. - Check the Execution Order settings in Project Settings to ensure
UIManagerinitializes beforePlayerHealth. - Implement a
UnityEventbased approach to decouple the UI from the Player lifecycle.
Connects securely to your tools. The creator never sees your data.
About this skill
Debugging Unity C# gameplay code is a time sink. Tracking down null references in deep lifecycles or fixing race conditions in async tasks often leads to more bugs when the fix is too broad.
This skill investigates C# gameplay and tooling issues using your logs, stack traces, and scripts. It produces evidence-linked diagnoses and minimal patches that respect your existing architecture.
What it does
- Error triage maps stack traces to specific code frames to find the first actionable failure.
- Lifecycle analysis identifies conflicts in MonoBehaviour execution order, coroutines, and object lifetimes.
- Serialization checks spots issues with Inspector references, prefab wiring, and Addressables.
- Patch generation provides minimal, safe code fixes that maintain your project's coding style.
- Test design creates specific Edit Mode and Play Mode test cases for regression protection.
How it works
- Provide context by sharing your script, the full stack trace, and the Unity version.
- Select a mode like
diagnosefor analysis orpatchfor a direct code solution. - Review hypotheses categorized by confidence levels and supporting evidence.
- Implement the fix using the provided code snippets and any required Inspector adjustments.
Frameworks & tools
Specifically optimized for Unity (C#) environments. Supports Unity Test Framework, Addressables, the New Input System, and standard MonoBehaviour lifecycles.
Why this beats prompting it yourself
Generic LLMs often suggest broad refactors or hallucinate APIs from other engines like Unreal or Godot. This skill enforces Unity-specific rules, distinguishing between Play Mode and build-only failures while preserving your specific serialization patterns.
Use cases
- Debugging
NullReferenceExceptionerrors triggered during scene transitions or player respawns. - Fixing event subscription leaks in UI components or singleton instances.
- Resolving frame-dependent physics bugs and Rigidbody configuration mismatches.
- Triaging build-only failures that do not appear in the Unity Editor.
Known limitations
Does not perform actual code execution or profiling. Relies entirely on provided code snippets and log artifacts. Optimized for Unity and C# only.
No real-time execution or profiler access. Restricted to Unity C# environments. Requires manually provided logs and code snippets to function.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 13 days ago