unity-testability

Isolate Unity domain logic into pure C# classes with testable seams.

1|Updated Feb 28, 2026
One-click install
npx skills add https://github.com/muddyrain/valley-mas --skill unity-testability-muddyrain
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-testability
Source: https://github.com/muddyrain/valley-mas/tree/main/.codex/skills/unity-skills/skills/testability
Command: npx skills add https://github.com/muddyrain/valley-mas --skill unity-testability-muddyrain

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unity testability advisor helps you separate logic from Unity-facing MonoBehaviours to enable reliable unit tests and easier maintenance.

Core Features & Use Cases

  • Determine what logic should reside in pure C# vs Unity-facing classes.
  • Plan and design EditMode and PlayMode tests with mocks and clean seams.
  • Provide a structured approach to isolating dependencies and testing strategies.

Quick Start

Analyze your existing Unity codebase to identify boundaries for pure C# classes and mockable interfaces.

Frequently Asked Questions about unity-testability

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

FAQPage Schema
How do I separate domain logic from MonoBehaviour for Unity testability?

To improve Unity testability, move domain logic into pure C# classes and use interfaces for dependency injection. This isolates logic from MonoBehaviour and scene state, creating clean seams for reliable unit tests.

What is the difference between EditMode and PlayMode tests when isolating Unity logic?

EditMode tests run faster by validating pure C# classes outside the Unity runtime, while PlayMode tests execute MonoBehaviour behavior within the Unity engine. Isolating domain logic into plain C# classes enables both testing strategies with mocks.

How do I structure testable seams for Unity dependency injection?

Structure testable seams by extracting dependencies into interfaces and injecting them into pure C# classes. This minimizes reliance on scene state and allows you to inject mocks during EditMode and PlayMode tests.

Can I refactor an existing Unity codebase to use pure C# classes for testing?

Yes, you can refactor an existing Unity codebase by analyzing current MonoBehaviour scripts to identify boundaries, then moving domain logic into plain C# classes with mockable interfaces to enable reliable unit tests.

Why does my Unity unit test fail when relying on scene state?

Unity unit tests fail when relying on scene state because MonoBehaviour dependencies are tightly coupled to the engine lifecycle. Isolating logic into pure C# classes removes scene state reliance and stabilizes test boundaries.

When should I not use MonoBehaviour for my Unity game logic?

Avoid using MonoBehaviour for game logic when you need reliable unit tests and easier maintenance. Move domain logic to pure C# classes to isolate dependencies and clarify test boundaries for clean architecture.