unity-scriptdesign

Reviews Unity gameplay scripts for coupling, lifecycle boundaries, and maintainability.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity gameplay scripts often grow into tightly-coupled god objects with unclear ownership of state, hidden dependencies, and per-frame performance waste. This Skill provides a structured design review that catches these problems before they become expensive refactors. ## Core Features & Use Cases - Design Review Checklist: Evaluates responsibility, MonoBehaviour vs ScriptableObject vs plain C# role choice, coupling, communication patterns, Update/Find performance issues, lifecycle cleanup, Inspector UX, testability, and naming. - Data Lifecycle Boundary Analysis: Classifies every field as authoring-time (ScriptableObject), composition-time (cached in Awake), or runtime-mutable (property plus event) to prevent mixed-ownership bugs. - Structured Output: Returns findings organized as Keep, Simplify, Refactor, Performance notes, and Maintainability notes. - Use Case: After generating a player controller and inventory system, run this review to discover that a public HP field is edited by both the Inspector and a power-up script, and get a concrete refactor plan using a read-only property with an OnHealthChanged event. ## Quick Start Review my Unity gameplay scripts for coupling and maintainability issues and suggest the highest-value refactor.

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?

Run a structured design review checking single responsibility, correct choice between MonoBehaviour, ScriptableObject, and plain C# class, explicit dependencies instead of hidden globals, and cleanup of subscriptions and timers. The output separates what to keep, simplify, and refactor.

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, fire rate, or level music tracks. Use MonoBehaviour for scene instances and composition-time references cached in Awake, and plain C# classes for testable core logic.

Why does my Unity variable break when designers tweak values?

This happens when a field has two owners, such as a public float edited by both the Inspector and a power-up script. Fix it by separating lifecycles: authoring-time values go in ScriptableObjects, runtime-mutable state uses a private backing field with a read-only property and change event.

What Unity performance issues should a code review catch?

A review should flag unnecessary Update methods, repeated Find or GetComponent calls in hot paths, avoidable allocations, and reflection during gameplay. Only real hotspots are reported, not theoretical micro-optimizations.

Can this review apply to Unity ECS projects?

Yes, the lifecycle separation mirrors the ECS baking pipeline distinction between Authoring components, Bakers, and Systems. The same discipline of not mixing authoring data with runtime write-back applies directly to MonoBehaviour design.