unity-scriptdesign

Reviews Unity gameplay scripts for coupling, lifecycle, performance, and maintainability issues.

Updated Aug 31, 2026
One-click install
npx skills add https://github.com/pikachu0310/codex-agent-ops-public --skill unity-scriptdesign-pikachu0310
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-scriptdesign
Source: https://github.com/pikachu0310/codex-agent-ops-public/tree/main/.agents/skills/unity-skills/skills/scriptdesign
Command: npx skills add https://github.com/pikachu0310/codex-agent-ops-public --skill unity-scriptdesign-pikachu0310

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity gameplay scripts often grow into tightly-coupled god objects with hidden dependencies, per-frame allocations, and unclear state ownership. This Skill provides a structured design review checklist that catches these problems before or after scripts are written. ## Core Features & Use Cases - Design Review Checklist: Evaluates responsibility, MonoBehaviour vs ScriptableObject vs plain C# role choice, coupling, communication patterns, performance hotspots, lifecycle cleanup, Inspector UX, testability, and naming. - Data Lifecycle Boundary Model: Classifies every field as authoring-time, composition-time, or runtime-mutable state, with concrete assignment examples and guidance on preventing mixed-ownership bugs. - Structured Output Format: Produces review results organized as Keep, Simplify, Refactor, Performance notes, and Maintainability notes. - Use Case: After generating a player controller and enemy AI scripts, run this review to catch a public mutable HP field, an uncached GetComponent call in Update, and a config value that belongs in a ScriptableObject. ## Quick Start Ask the AI to review your Unity gameplay scripts using the script design checklist and report the highest-value refactor, real performance hotspots, and maintainability issues.

Frequently Asked Questions about unity-scriptdesign

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

FAQPage Schema
How do I review Unity C# scripts for code quality?

Apply a structured checklist covering single responsibility, correct choice between MonoBehaviour, ScriptableObject, and plain C# class, explicit dependencies, event-based communication, and cleanup of subscriptions and async work. Report findings as keep, simplify, and refactor items.

When should I use ScriptableObject instead of MonoBehaviour in Unity?

Use ScriptableObject for authoring-time data decided by designers before Play, such as weapon damage or level music, so balance values stay immutable at runtime and hot-swappable. Use MonoBehaviour for scene-attached behavior and plain C# classes for testable core logic.

What performance problems should I look for in Unity scripts?

Focus on real hotspots: unnecessary Update methods, repeated Find or GetComponent calls per frame, avoidable allocations, and reflection in hot paths. Cache component references in Awake and avoid theoretical micro-optimizations.

Why does my Unity value break when a designer tweaks it in the Inspector?

This happens when a field mixes authoring-time and runtime-mutable lifecycles, giving it two owners with no invariant. Move designer-tuned values into a ScriptableObject or serialized private field and expose runtime state through read-only properties with change events.

How do I make Unity gameplay logic unit testable?

Move core logic out of MonoBehaviour into plain C# classes that do not depend on the Unity engine lifecycle. Keep MonoBehaviours as thin adapters that wire cached references and forward events to the testable logic.