unity-architecture
Skill4 starsChanged 3 months agoMITView on GitHub
Structure Unity projects with ScriptableObjects, decoupled systems and single-responsibility components. Use when structuring Unity projects, ScriptableObjects, or DOTS/ECS.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- badjano/skillstheir own version, first seen Oct 5, 2026
- aluminumBath/unity-meshy-studiotheir own version, first seen Jul 12, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- badjano/skills★ 1same name
- aluminumBath/unity-meshy-studio★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository47 other files it gives its agents.
- anti-cheatSkill
- blender-add-on-engineerSkill
- blender-animationSkill
- blender-modelingSkill
- blender-toolingSkill
- game-aiSkill
- game-audio-engineerSkill
- game-audioSkill
- game-build-pipelineSkill
- game-designerSkill
- game-designSkill
- game-ideationSkill
- game-monetization-designerSkill
- game-monetizationSkill
- game-performanceSkill
- game-uiSkill
- game-version-controlSkill
- godot-gameplay-scripterSkill
- godot-multiplayer-engineerSkill
- godot-shader-developerSkill
- level-designerSkill
- level-designSkill
- narrative-designerSkill
- narrative-designSkill
- playtest-feedback-analyzerSkill
- playtestingSkill
- production-planningSkill
- roblox-avatar-creatorSkill
- roblox-experience-designerSkill
- roblox-systems-scripterSkill
- tech-artSkill
- technical-artistSkill
- unity-architectSkill
- unity-editor-tool-developerSkill
- unity-multiplayer-engineerSkill
- unity-multiplayerSkill
- unity-shader-graph-artistSkill
- unity-shadersSkill
- unity-toolingSkill
- unreal-multiplayer-architectSkill
- unreal-multiplayerSkill
- unreal-systems-engineerSkill
- unreal-systemsSkill
- unreal-tech-artSkill
- unreal-technical-artistSkill
- unreal-world-builderSkill
- unreal-worldsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 52
Use interfaces for subsystem interactions (e.g.
- Very specific: line 56
Create a RuntimeSet<T> ScriptableObject.
- Very specific: line 61
Use standard MonoBehaviour + ScriptableObjects for high-level gameplay, menus, and quests.
- Distinctive: line 62
Use Unity DOTS (Entities, IJobEntity, Burst Compiler) when simulating $> 5,000$ concurrent active entities (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
unity-architecture
Core Philosophy
Monolithic MonoBehaviour architectures turn Unity projects into unmaintainable spiderwebs. When every script references every other script via GetComponent, FindObjectOfType, or static singletons, changing a player's health logic breaks the UI, sound manager, and save system simultaneously. Scalable Unity architecture relies on ScriptableObject-driven architecture (Ryan Hipple pattern), event-driven decoupling, Single Responsibility components, and data-oriented design (DOTS/ECS) for performance-critical systems.
4-Step Unity Architecture Patterns
Step 1: ScriptableObject Architecture (Modular Data & Events)
- ScriptableObject Variables:
- Store shared game state (Player Health, Ammo, Score) in ScriptableObject assets instead of static singletons:
[CreateAssetMenu(menuName = "Variables/FloatVariable")] public class FloatVariable : ScriptableObject { public float Value; }
- Store shared game state (Player Health, Ammo, Score) in ScriptableObject assets instead of static singletons:
- ScriptableObject Game Events:
- Broadcast events without direct coupling between caller and listener:
[CreateAssetMenu(menuName = "Events/GameEvent")] public class GameEvent : ScriptableObject { private readonly List<GameEventListener> listeners = new(); public void Raise() { for (int i = listeners.Count - 1; i >= 0; i--) listeners[i].OnEventRaised(); } public void Register(GameEventListener l) => listeners.Add(l); public void Unregister(GameEventListener l) => listeners.Remove(l); }
- Broadcast events without direct coupling between caller and listener:
Step 2: Decoupled Component Architecture
- Single Responsibility Components:
- Break mega-scripts like
PlayerController.cs(3,000 lines) into isolated single-purpose components:PlayerInputReader.cs(Translates raw inputs to movement vectors).PlayerMotor.cs(Executes CharacterController physics).PlayerHealth.cs(Manages damage calculations and invokes events).PlayerAudioFeedback.cs(Listens to health events and plays footstep/hit clips).
- Break mega-scripts like
- Interface Segregation:
- Use interfaces for subsystem interactions (e.g.
IDamageable,IInteractable).
- Use interfaces for subsystem interactions (e.g.
Step 3: Runtime Sets for Dynamic Entity Tracking
- Replacing
FindObjectsOfType:- Create a
RuntimeSet<T>ScriptableObject. When an enemy spawns, it adds itself toEnemyRuntimeSet; on destroy, it removes itself. - Systems query the set in $O(1)$ time with zero GC allocation or scene tree traversal.
- Create a
Step 4: DOTS / ECS for Scale (When to Reach for Data-Oriented Tech)
- Object-Oriented vs Data-Oriented (DOTS):
- Use standard
MonoBehaviour+ScriptableObjectsfor high-level gameplay, menus, and quests. - Use Unity DOTS (Entities, IJobEntity, Burst Compiler) when simulating $> 5,000$ concurrent active entities (e.g. bullet hell projectiles, swarm crowds, voxel terrain).
- Use standard
Deliverable Format: Decoupled ScriptableObject Event System
// GameEventListener.cs: Attach to any GameObject that reacts to an event
using UnityEngine;
using UnityEngine.Events;
public class GameEventListener : MonoBehaviour {
[SerializeField] private GameEvent gameEvent;
[SerializeField] private UnityEvent response;
private void OnEnable() => gameEvent.Register(this);
private void OnDisable() => gameEvent.Unregister(this);
public void OnEventRaised() => response.Invoke();
}Worked Example: Refactoring a Spaghetti Boss Fight
- Problem: In a boss encounter,
BossAI.csheld direct references toPlayerController,UIManager,CameraShake,AudioManager, andSaveSystem. Updating the UI caused null reference exceptions in Boss AI during scene transitions. - Refactoring:
- Replaced direct references with 2 ScriptableObject events:
OnBossPhaseChangedandOnBossDied. - UI, Camera, Audio, and Save scripts registered as independent listeners via
GameEventListener.
- Replaced direct references with 2 ScriptableObject events:
- Result:
BossAI.csline count reduced from 1,420 lines to 310 lines. Zero scene reload reference bugs.
Verification Checklist
- Zero usage of
FindObjectOfType()or string-basedSendMessage()in runtime loops. - Shared state stored in
ScriptableObjectassets rather than mutable static singletons. - Game events broadcast via ScriptableObject events or C# delegates.
- Entity discovery utilizes
RuntimeSetsrather than heavy scene scans. - Heavy simulations (> 5,000 entities) isolated into DOTS / Burst-compiled jobs.
Anti-Patterns
- God Singletons: Creating a
GameManager.cssingleton that controls player input, UI, high scores, audio, and network sockets in 4,000 lines. - Tight Coupling via
GetComponentinUpdate(): CallingGetComponent<Animator>()every frame insideUpdate(). - Scene-Bound State: Storing high scores and inventory state on scene objects, causing data loss upon
SceneManager.LoadScene().
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

