unity-testability

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

2|Updated May 18, 2026
One-click install
npx skills add https://github.com/pcone-mm/NewFPG --skill unity-testability-pcone-mm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-testability
Source: https://github.com/pcone-mm/NewFPG/tree/main/.agents/skills/unity-skills/skills/testability
Command: npx skills add https://github.com/pcone-mm/NewFPG --skill unity-testability-pcone-mm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity code often tangles game 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 to extract into plain C# classes and how to plan EditMode and PlayMode test coverage. ## Core Features & Use Cases - Testability Review Questions: Systematic checks for whether logic can run without Transform, GameObject, or scene state, and whether config can be injected instead of read from static globals. - Refactoring Guidance: Identifies which logic should move to pure C# classes and which should stay in thin Unity-facing MonoBehaviour wrappers, with suggested seams and interfaces. - Test Planning: Produces candidate EditMode tests for pure logic and PlayMode tests for scene-dependent behavior. - Use Case: You have a 300-line MonoBehaviour handling inventory rules and want to unit test it. The Skill advises extracting the inventory rules into a plain C# class with injected config, keeping only Unity event wiring in the MonoBehaviour, then lists candidate EditMode tests for the rules and PlayMode tests for the integration. ## Quick Start Ask the assistant to review a Unity script for testability and suggest how to extract logic for EditMode and PlayMode 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 through constructors or parameters 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 with no scene dependencies. PlayMode tests run in a live scene and cover behavior that requires GameObjects, physics, or runtime state.

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

Keep logic in the MonoBehaviour when the script is tiny and inherently scene-bound, such as simple input forwarding or visual wiring. The Skill's guardrails warn against forcing test seams everywhere; prefer a few meaningful seams over abstraction for its own sake.

How do I replace static singletons in Unity for better testing?

Pass configuration and dependencies into classes through constructors or method parameters rather than reading static globals. This lets EditMode tests inject controlled values and removes hidden coupling to global state.

Does this approach require extra Unity packages or test frameworks?

No external dependencies are required. The Skill provides advisory guidance only and works with Unity's built-in Test Framework concepts of EditMode and PlayMode tests.