unity-testability

Advises on separating Unity-facing code from pure C# logic for testability.

Updated Aug 18, 2026
One-click install
npx skills add https://github.com/ethanJPope/Our-Main-Hackathon-Game --skill unity-testability-ethanjpope
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-testability
Source: https://github.com/ethanJPope/Our-Main-Hackathon-Game/tree/main/.agents/skills/unity-skills/skills/testability
Command: npx skills add https://github.com/ethanJPope/Our-Main-Hackathon-Game --skill unity-testability-ethanjpope

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity projects often mix game logic directly into MonoBehaviour classes, making code hard to unit test. This Skill helps you decide which logic should move into pure C# classes and which should stay Unity-facing, so you can build a practical test strategy. ## Core Features & Use Cases - Testability Review Questions: Evaluate whether logic can run without Transform, GameObject, or scene state, and whether config can be injected instead of read from static globals. - Structured Output: Get a breakdown of logic to move to pure C#, logic to keep Unity-facing, suggested seams/interfaces, and candidate EditMode and PlayMode tests. - Use Case: You have a MonoBehaviour that calculates damage, reads difficulty from a static config, and spawns effects. Use this Skill to identify that the damage calculation should become a plain C# class with injected config, covered by EditMode tests, while the MonoBehaviour stays as a thin scene-binding layer. ## Quick Start Ask the assistant to review your Unity script for testability and suggest which logic to extract into pure C# classes with candidate 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 code more testable?

Move logic that does not depend on Transform, GameObject, or scene state into plain C# classes, and call them from thin MonoBehaviour wrappers. Inject configuration through parameters instead of reading static globals so tests can supply their own values.

How to decide between EditMode and PlayMode tests in Unity?

Use EditMode tests for pure C# logic that runs without a scene, since they are faster and simpler. Reserve PlayMode tests for behavior that genuinely requires scene state, GameObjects, or the runtime environment.

Should every Unity script have test seams and interfaces?

No. Tiny scene-bound scripts do not benefit from forced abstraction. Prefer a few meaningful seams where logic is complex or reused, rather than adding interfaces for their own sake.

What logic should stay in a MonoBehaviour?

Code that directly touches scene state, such as Transform manipulation, GameObject lifecycle, and Unity event callbacks, should stay Unity-facing. The MonoBehaviour acts as a thin adapter that delegates decisions to plain C# classes.

Can static configuration be unit tested in Unity?

Static globals make testing difficult because tests cannot control their values. Refactor so configuration is passed in as a parameter or injected dependency, allowing EditMode tests to supply controlled inputs.