Component design

From TheArcForge/UniClaude · View interactive version

Component design is an AI agent skill from the GitHub repository TheArcForge/UniClaude. Use when you need detailed decision frameworks for MonoBehaviour composition, inter-component communication, single responsibility, and execution order.

How to use this skill

Skill file

Component Design — Full Decision Framework

Use this when unity-architect's condensed component section needs more depth.

DECISION: Splitting Responsibilities

When this applies: A script is growing or handles multiple concerns.

Split signals (do split):

Keep-together signals (do not split):

Naming convention:

DECISION: Inter-Component Communication

When this applies: Components on the same or different GameObjects need to interact.

Options (ordered by coupling, lowest first):

  1. ScriptableObject event channel — fully decoupled, asset-based.
  1. C# events (Action/delegate) — component exposes an event.
  1. Interface + GetComponent — polymorphic access.
  1. Direct serialized reference — [SerializeField] to another component.

Decision tree:

Do the components know about each other?
├── NO (decoupled systems) → SO event channel
└── YES → One-to-many notification?
    ├── YES → C# event (Action<T>)
    └── NO → Need polymorphism?
        ├── YES → Interface + TryGetComponent
        └── NO → Direct [SerializeField] reference

DECISION: Lifecycle Order

Standard method ordering in a MonoBehaviour file:

Fields (serialized, then private)
Awake()         → self-initialization only
OnEnable()      → subscribe to events, register
Start()         → cross-object initialization
FixedUpdate()   → physics logic
Update()        → per-frame logic
LateUpdate()    → follow/camera logic
OnDisable()     → unsubscribe, unregister
OnDestroy()     → dispose resources

Rules:

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.