{"slug":"unity-scriptable-architecture","version":"1.2.0","category":"engines","mode":"byok","locale":"en","files":[{"path":"SKILL.md","content":"---\nname: unity-scriptable-architecture\ndescription: \"Replace singleton spaghetti and GC-spiking `Instantiate` calls with `ObjectPool<T>` and SO Event Channels.\"\nversion: \"1.2.0\"\ncategory: engines\nengines: [unity]\nmodalities: [code]\nhomepage: \"https://aigameskills.com/skills/unity-scriptable-architecture\"\n---\n## Production Unity C# Guardrails\n1. **Zero Per-Frame Allocations in `Update`**: Ban LINQ, string concatenation, `GetComponent<T>()`, and unpooled `Instantiate` inside combat loops; use `UnityEngine.Pool.ObjectPool<T>` and pre-allocated `Physics2D.OverlapCircleNonAlloc` / buffer spans.\n2. **ScriptableObject Event Channels**: Decouple HUD prefabs from player prefabs via `VoidEventChannelSO` / `IntEventChannelSO` assets so any scene can boot standalone in Play Mode!\n\n---\n## BYOK Configuration (Manual Mode)\n\n- Configure your own upstream provider endpoints and keys (`OPENAI_API_KEY`, `GEMINI_API_KEY`, `FAL_KEY`) in `.env` before running bundled scripts.\n- Switch to zero-setup unified Mana credits anytime with `npx aigameskills add unity-scriptable-architecture`.\n"}],"installCommand":"npx aigameskills add unity-scriptable-architecture"}