unity-folder-conventions
Skill1 starsChanged 5 months agoMITView on GitHub
Folder structure conventions for Unity projects. ALWAYS Auto-loaded when creating files or folders in Unity projects.
In this repository9 other files it gives its agents.
- unity-architecture-conventionsSkill
- unity-coding-conventionsSkill
- unity-mcp-toolsSkill
- unity-performanceSkill
- unity-testingSkill
- unity-ugui-developmentSkill
- unity-ugui-listSkill
- writing-testsSkill
- zenject-conventionsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Follow these conventions when creating, moving, or placing files and folders in the Unity project.
- Very specific: line 52
All third-party code in Plugins/.
- Very specific: line 53
Never place first-party assets loose at Assets/ root.
- Distinctive: line 99
Create sub-folders only as needed.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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 Folder Conventions
Follow these conventions when creating, moving, or placing files and folders in the Unity project.
Quick Reference: Where Does This File Go?
| Asset Type | Path Pattern | Example |
| Feature script | _Module/{Feature}/Scripts/{Role}/ | _App/Scoring/Scripts/Services/ScoreManager.cs |
| Feature prefab | _Module/{Feature}/Prefabs/ | _App/Gameplay/Prefabs/LineSpawner.prefab |
| Feature UI prefab | _Module/{Feature}/Prefabs/UI/ | _App/Scoring/Prefabs/UI/ScoreUIPanel.prefab |
| Feature data (SO) | _Module/{Feature}/Data/ | _App/Gameplay/Data/DifficultyConfig.asset |
| Feature scene | _Module/{Feature}/Scenes/ | _App/Gameplay/Scenes/GameplayScene.unity |
| Feature art | _Module/{Feature}/Art/ | _App/Gameplay/Art/Models/ |
| Feature audio | _Module/{Feature}/AudioClips/ | _App/Audio/AudioClips/SFX/ |
| Feature installer | _Module/{Feature}/Scripts/Installers/ | _App/Scoring/Scripts/Installers/ScoringInstaller.cs |
| Shared script | _Module/Shared/Scripts/ | _App/Shared/Scripts/Services/ |
| Shared data model | _Module/Shared/Scripts/DataModel/{Domain}/ | _App/Shared/Scripts/DataModel/ |
| Shared prefab | _Module/Shared/Prefabs/ | _App/Shared/Prefabs/UI/Button.prefab |
| Shared scene | _Module/Shared/Scenes/ | _App/Shared/Scenes/BaseScene.unity |
| Root Zenject installer | _Module/Shared/Scripts/Installers/ | _App/Shared/Scripts/Installers/BaseSceneInstaller.cs |
| Zenject config asset | _Module/Shared/Zenject/Resources/ | _App/Shared/Zenject/Resources/ |
| Config SO | _Module/Shared/Data/ | _App/Shared/Data/AppConfiguration.asset |
| Core runtime script | _Core/{Category}/Scripts/ | _Core/Data/Scripts/IIdentifiable.cs |
| Core editor script | _Core/Editor/Scripts/{Category}/ | _Core/Editor/Scripts/AutomationHelpers/ScriptExecutor.cs |
| Editor script | _Module/Editor/{Feature}/Scripts/ | _App/Editor/Scoring/Scripts/ScoreInspector.cs |
| Edit mode test | _Module/Tests/Editor/{Feature}/{Role}/ | _App/Tests/Editor/Scoring/Services/ScoreManagerTests.cs |
| Play mode test | _Module/Tests/Runtime/{Feature}/{Role}/ | _App/Tests/Runtime/Scoring/Services/ScoreManagerIntegrationTests.cs |
Top-Level Structure
Assets/
├── _Core/ # Shared/foundational code used by all modules
├── _AppName/ # Main application module
├── Plugins/ # All third-party libraries and assets
├── Settings/ # Render pipeline and project settings
└── ... # Root-level folders only when Unity/plugins require it- Prefix first-party modules with underscore (
_). _Core= shared code consumed by other modules. App-specific code goes in_AppName.- All third-party code in
Plugins/. - Never place first-party assets loose at
Assets/root.
Module Layout (Feature-First)
Each feature gets its own top-level folder containing all asset types. Cross-feature assets go in Shared/. Tests are centralized but mirror the source structure. The Tests/ folder and test asmdefs only exist if the project uses tests.
_Module/
├── Module.asmdef # Single production assembly (no underscore in asmdef name)
├── {Feature}/
│ ├── Scripts/
│ ├── Prefabs/
│ ├── Scenes/
│ ├── Data/
│ ├── Art/
│ ├── AudioClips/
│ ├── Videos/
│ └── Fonts/
├── {Feature}/
│ └── ...
├── Shared/
│ ├── Scripts/
│ ├── Prefabs/
│ ├── Scenes/
│ ├── Data/
│ ├── Art/
│ ├── Fonts/
│ ├── Zenject/
│ │ └── Resources/
│ └── Misc/
├── Editor/ # Editor-only code (created on demand)
│ ├── Module.Editor.asmdef # Separate editor assembly
│ └── {Feature}/Scripts/ # Mirrors feature structure
└── Tests/
├── Editor/
│ ├── Module.Tests.Editor.asmdef
│ └── {Feature}/{Role}/ # Mirrors source structure
└── Runtime/
├── Module.Tests.Runtime.asmdef
└── {Feature}/{Role}/ # Mirrors source structure- A feature folder contains everything that feature needs.
- Multi-feature or featureless assets go in
Shared/. - Create sub-folders only as needed. Not every feature needs Art/ or AudioClips/.
Shared/follows the same internal structure as a feature folder.Editor/is created on demand when editor tooling is first needed. It gets its own asmdef (Module.Editor.asmdef) that references the runtime module.
Scripts
Sub-roles within a feature
{Feature}/Scripts/
├── UI/ # UI panels, canvas controllers
├── Behaviour/ # Game logic, managers
├── Data/ # Data classes, SO definitions
├── Services/ # Service implementations
└── Installers/ # Zenject installersService interface pattern
{Feature}/Scripts/Services/
├── I{ServiceName}.cs # Interface
├── {ServiceName}.cs # Implementation
└── Dummy{ServiceName}.cs # Optional mock/stubCore module (_Core)
Organized by technical category, not by feature. Has its own assembly definitions.
_Core/
├── Core.asmdef # Core runtime assembly
├── {Category}/
│ ├── Scripts/
│ ├── Prefabs/
│ └── ...
├── Shared/
│ └── Scripts/ # Cross-category runtime scripts (e.g., ContextInfo)
└── Editor/
├── Core.Editor.asmdef # Core editor assembly
└── Scripts/
└── {Category}/ # Editor-only tools organized by category- Categories are broad technical domains (e.g.,
Data/,UI/,Networking/). If a category only has 1-2 scripts, it belongs in the app module'sShared/instead. Core.Editor.asmdefreferencesCore.- The app module's asmdef references
Core. The app editor asmdef referencesCoreandCore.Editor.
Prefabs
- Feature-specific:
{Feature}/Prefabs/(UI prefabs in{Feature}/Prefabs/UI/) - Generic reusable UI:
Shared/Prefabs/UI/ - Runtime service objects:
Shared/Prefabs/Services/ - Environment/level prefabs:
Shared/Prefabs/Environments/
ScriptableObjects & Data
| Load Strategy | Path | Use Case |
| Design-time (inspector refs) | {Feature}/Data/ or Shared/Data/ | Config, definitions |
Runtime (Resources.Load) | {Feature}/Resources/ or Shared/Resources/ | Dynamic content |
| Zenject injection | Shared/Zenject/Resources/ | DI config |
- Feature-specific SOs in
{Feature}/Data/. Subfolders for collections. - App-wide config SOs in
Shared/Data/.
Scenes
- Core/bootstrap scenes in
Shared/Scenes/. - Feature-specific scenes in
{Feature}/Scenes/. - Scene-generated data (LightingData, NavMesh) in auto-created subfolder named after the scene.
Tests
If the project doesn't use tests, this entire section does not apply — no test folders or test asmdefs exist.
Tests are centralized in _Module/Tests/ (one production asmdef, two test asmdefs) but mirror the source folder structure exactly.
Path mirroring rule
Given a source file, derive the test path by:
- Replace
_Module/→_Module/Tests/Editor/(orTests/Runtime/) - Drop
/Scriptsfrom the path - Append
Teststo the filename
| Source | Test |
_App/Scoring/Scripts/Services/ScoreManager.cs | _App/Tests/Editor/Scoring/Services/ScoreManagerTests.cs |
_App/Input/Scripts/Behaviour/SwipeDetector.cs | _App/Tests/Editor/Input/Behaviour/SwipeDetectorTests.cs |
_App/Shared/Scripts/Services/AudioService.cs | _App/Tests/Editor/Shared/Services/AudioServiceTests.cs |
Assembly definitions
Core.asmdef— core runtime assembly at_Core/rootCore.Editor.asmdef— core editor assembly at_Core/Editor/, references:CoreModule.asmdef— production assembly at module root (no underscore prefix in asmdef names), references:CoreModule.Editor.asmdef— editor tools at_Module/Editor/(created on demand), references:Module,Core,Core.EditorModule.Tests.Editor.asmdef— edit mode tests, references:Module,Core,nunit.framework,Zenject,Zenject.TestFrameworkModule.Tests.Runtime.asmdef— play mode tests, references:Module,Core,nunit.framework,UnityEngine.TestRunner,Zenject,Zenject.TestFramework
When to use Edit Mode vs Play Mode
- Edit Mode: Pure logic, calculations, state machines, services — anything that doesn't need MonoBehaviour lifecycle
- Play Mode: Tests that require
Start()/Update(), coroutines, physics, scene loading, or full Zenject container setup
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.

