unity-scripting-advanced

Implements Unity C# component architecture, ScriptableObjects, event systems, and object pooling patterns.

Updated Mar 27, 2026
One-click install
npx skills add https://github.com/gmackie/agent-skills --skill unity-scripting-advanced-gmackie
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: unity-scripting-advanced
Source: https://github.com/gmackie/agent-skills/tree/main/skills/unity-scripting-advanced
Command: npx skills add https://github.com/gmackie/agent-skills --skill unity-scripting-advanced-gmackie

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building complex Unity gameplay systems often leads to tightly coupled, hard-to-maintain code. This Skill provides proven C# patterns for modular component architecture, data-driven design, and performance optimization so your Unity projects stay scalable and debuggable. ## Core Features & Use Cases - Component-Based Architecture: Define interfaces like IHealth and IMovement with decoupled MonoBehaviour implementations and UnityEvent-driven communication. - ScriptableObject Data Design: Manage game data such as weapons and game events through CreateAssetMenu assets instead of hardcoded values. - Performance Patterns: Generic object pooling, state machines for enemy AI, and runtime performance profiling with FPS and memory logging. - Use Case: Ask the AI to generate a state machine for enemy AI behavior, then wire it to a pooled projectile system backed by ScriptableObject weapon data. ## Quick Start Use the unity-scripting-advanced skill to create a player controller with jump, dash, and wall-slide mechanics using component-based architecture.

Frequently Asked Questions about unity-scripting-advanced

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

FAQPage Schema
How do I create a state machine for enemy AI in Unity?▼

Define an abstract State class with Enter, Update, and Exit methods, then a StateMachine MonoBehaviour that calls ChangeState to transition between states. Concrete states like IdleState check conditions such as PlayerInRange and trigger transitions to ChaseState.

How to use ScriptableObjects for game data in Unity?▼

Create a ScriptableObject class with CreateAssetMenu to define data assets like WeaponData containing damage, fire rate, and prefab references. Controllers then reference these assets, keeping data decoupled from scene objects and editable in the Inspector.

What is the best way to implement object pooling in Unity?▼

Use a generic ObjectPool<T> class that pre-instantiates a queue of inactive objects, dequeues them on Get(), and re-enqueues on Return(). Enable allowGrowth to expand the pool at runtime and log pool stats to monitor active versus pooled counts.

Does this Unity scripting skill require unity-mcp?▼

The patterns work in any Unity project, but AI-assisted code generation features require unity-mcp connected to the Unity Editor plus Visual Studio or Rider. Without unity-mcp, you can still apply the C# architecture patterns manually.

Why is my Unity event system not firing?▼

GameEvent listeners must register in OnEnable and unregister in OnDisable, and the ScriptableObject event asset must be assigned in the Inspector. Check that Raise() is actually invoked and add debug logs to confirm listener registration counts.

How do I fix object pool memory leaks in Unity?▼

Memory leaks occur when active objects are destroyed instead of returned to the pool. Always call Return() to deactivate and re-enqueue objects, and use the LogPoolStats context menu to verify active and pooled counts stay balanced.