unity-testability

Advises on extracting logic from MonoBehaviour classes for EditMode and PlayMode tests.

Updated Oct 13, 2025
One-click install
npx skills add https://github.com/Darth-Carrotpie/ProxyCore --skill unity-testability-darth-carrotpie
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: unity-testability
Source: https://github.com/Darth-Carrotpie/ProxyCore/tree/main/.agents/skills/unity-skills/skills/testability
Command: npx skills add https://github.com/Darth-Carrotpie/ProxyCore --skill unity-testability-darth-carrotpie

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity code often tangles business logic inside MonoBehaviour classes tied to GameObjects, Transforms, and scene state, making it nearly impossible to unit test. This Skill helps you decide what logic should move into pure C# classes and what should stay Unity-facing, so you can build a practical test strategy. ## Core Features & Use Cases - Testability Review Questions: Structured prompts to check whether logic can run without scene state, whether config can be injected, and whether a thin MonoBehaviour wrapper is enough. - EditMode vs PlayMode Guidance: Helps you decide which test type fits each piece of logic instead of defaulting to slow PlayMode tests. - Seam and Interface Suggestions: Recommends meaningful abstraction seams without over-engineering tiny scene-bound scripts. - Use Case: You have a 300-line MonoBehaviour handling inventory rules and UI. Use this Skill to identify which rules can move to a plain C# class, then plan EditMode tests for them while keeping only rendering logic Unity-facing. ## Quick Start Ask the agent to review this MonoBehaviour script and suggest how to make it testable with EditMode unit tests.

Frequently Asked Questions about unity-testability

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make Unity MonoBehaviour code unit testable?▼

Move rules and algorithms that do not need Transform, GameObject, or scene state into plain C# classes, then call them from a thin MonoBehaviour. Inject configuration instead of reading static globals so EditMode tests can supply test values.

What is the difference between EditMode and PlayMode tests in Unity?▼

EditMode tests run in the editor without entering play mode and suit pure C# logic. PlayMode tests run in a live scene and are needed for behaviour that depends on GameObjects, physics, or frame updates.

When should logic stay in a MonoBehaviour instead of being extracted?▼

Keep logic Unity-facing when it is tiny and tightly bound to scene objects, such as simple transform updates or input forwarding. Forcing seams everywhere adds abstraction without improving testability.

How do I replace static globals in Unity code for testing?▼

Pass configuration through constructor or method parameters instead of reading static singletons. This lets EditMode tests inject controlled values and keeps the pure C# class free of hidden dependencies.

Can I test Unity code without entering Play mode?▼

Yes, any logic extracted into plain C# classes can be covered by EditMode tests, which run directly in the editor. Only code that depends on scene state, physics, or the runtime loop requires PlayMode coverage.