unity-testability

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

Updated Jan 29, 2026
One-click install
npx skills add https://github.com/Dylan8865/FinalYearProject --skill unity-testability-dylan8865
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: unity-testability
Source: https://github.com/Dylan8865/FinalYearProject/tree/main/GameDev/Tester/.agents/skills/unity-skills/skills/testability
Command: npx skills add https://github.com/Dylan8865/FinalYearProject --skill unity-testability-dylan8865

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity code tightly coupled to MonoBehaviour, GameObject, and scene state is hard to unit test, leaving developers unsure how to structure code for test coverage. ## Core Features & Use Cases - Testability Review Questions: Evaluates whether logic can run without Transform, GameObject, or scene state, and whether configuration 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 and PlayMode test lists. Use Case: a developer with an untestable gameplay script asks how to test it, and receives a split of pure C# logic versus Unity-facing code plus a concrete test plan. ## Quick Start Ask the assistant to review your Unity script for testability and suggest how to extract logic into pure C# classes with EditMode and PlayMode test candidates.

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 parameters instead of reading static globals so tests can supply their own 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 when behavior depends on GameObjects, physics, or runtime scene state.

When should logic stay in a MonoBehaviour instead of a pure C# class?▼

Keep logic Unity-facing when it is tiny and tightly bound to scene objects, lifecycle callbacks, or engine APIs. Forcing test seams everywhere adds abstraction without benefit; prefer a few meaningful seams over abstraction for its own sake.

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

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

Does this skill modify or execute Unity project code?▼

No, it is documentation-only guidance with no scripts or REST operations. It loads freely under any operating mode and only produces review questions, refactoring suggestions, and candidate test lists.