Clean Folder Structure (IDE)
Unreal Engine's default C++ folder layout works, but it quickly becomes a mess as your game grows. A well-structured Source
folder can save hours of debugging and onboarding headaches.
Hereβs a clean and modular C++ folder structure that scales with solo and team development.
π Folder Structureβ
This goes inside your Source/YourProject
directory:
Source/YourProject/
β
βββ Core/
β βββ YourProject.h
β βββ YourProject.cpp
β βββ LogChannels.h # Centralized log categories
β βββ Utility/ # Macros, helpers, common utilities
β
βββ Framework/ # Game framework classes
β βββ GameMode/
β βββ GameState/
β βββ Player/ # Player-specific logic
β β βββ Character/
β β βββ Controller/
β β βββ State/
β βββ HUD/ # HUD/UI related to gameplay
β
βββ AI/ # Artificial intelligence
β βββ Controllers/ # AAIController subclasses
β βββ BehaviorTrees/ # BTs, services, tasks, decorators
β βββ Perception/ # Perception system classes
β βββ Data/ # Blackboard data, config
βββ Systems/ # Self-contained gameplay systems
β βββ Inventory/ # Inventory system implementation
β β βββ InventorySystem # Core system classes
β β βββ InventoryComponents # Component(s) related to inventory
β β βββ InventoryEnums # Enums used by inventory system
β β βββ InventoryStructs # Structs and data structures
β β βββ InventoryDataAssets # UDataAsset definitions
β β βββ InventoryInterfaces # Interfaces used by inventory system
β β βββ [Etc...]
β β
β βββ Abilities/ # Gameplay abilities system
β β βββ AbilitySystem
β β βββ AbilityComponents
β β βββ AbilityEnums
β β βββ AbilityStructs
β β βββ AbilityDataAsset
β β βββ AbilityInterfaces
β β βββ [Etc...]
β β
β βββ Interaction/ # Player or world interaction system
β β βββ InteractionSystem
β β βββ InteractionComponents
β β βββ InteractionEnums
β β βββ InteractionStructs
β β βββ InteractionInterfaces
β β βββ [Etc...]
β β
β βββ [Other systemsβ¦]
β
βββ Input/ # Enhanced Input support
β βββ Config/ # InputMappingContexts, InputActions
β βββ Handlers/ # Custom input logic or wrappers
β
βββ UI/
β βββ Widgets/ # UUserWidget classes
β βββ Data/ # UI-related data assets and enums etc...
β
βββ Editor/ # Editor tools, widgets, etc.
β βββ Widgets/
β βββ Data/
β
βββ Dev/ # Temporary/test/dev-only code
β βββ Sandbox/
β
βββ YourProject.Build.cs # Build configuration file
π§ Breakdownβ
Coreβ
Core headers, macros, and logging config. Usually where your precompiled header (YourProject.h
) and main module file (YourProject.cpp
) live.
Contains utilities and helper functions common across your entire project.
Frameworkβ
Contains core gameplay framework logic such as GameMode
, GameState
, HUD
, and player-specific classes like Character
, Controller
, and PlayerState
.
AIβ
Holds all AI-related logic including behavior trees, blackboard data, AI controllers, and perception components.
Systemsβ
Self-contained gameplay systems that encapsulate specific game mechanics. Designed to be modular for reuse or plugin conversion.
-
Inventory Implements all inventory-related features: core systems, components for inventory management, enums for item types or states, data structures for item definitions, UDataAssets for configurable data, and interfaces for interaction contracts.
-
Abilities Manages gameplay abilities including the ability system core, ability-related components, enums, structs, data assets, and interfaces to define ability behaviors and effects.
-
Interaction Handles player or world interaction systems: interaction logic, components, enums to define interaction types, data structs, and interfaces to implement consistent interaction contracts.
-
Other systems Add more gameplay systems as needed, following the same modular structure.
Inputβ
Contains all input-related logic and configuration, such as input mapping contexts, input actions, and input components.
UIβ
Contains your UUserWidget
C++ classes and any supporting UI logic or data (e.g. data tables, UI enums).
- Widgets: All UUserWidget subclasses for HUD elements, menus, and UI components.
- Data: UI-related data assets, enums, and supporting structures.
Editorβ
Includes tools, custom editors, and development-only assets used to enhance the Unreal Editor experience.
Devβ
Temporary or experimental code and sandbox tests. Useful for prototyping and development without affecting production code. Should be excluded from shipping builds.
βοΈ Naming Conventionsβ
Stick to Unrealβs coding standards but you can adopt slight variations for clarity:
- Classes:
U
,A
,F
,I
prefixes (e.g.UUserWidget
,AEnemy
,FItemData
,IInteractable
) - Components:
UYourProject[Name]Component
(e.g.UYourProjectHealthComponent
) - Systems: Folder-level prefixes like
Inventory/
,Abilities/
, etc. - Log Categories: Use a centralized
LogChannels.h
β Best Practicesβ
- 1 class per file: Avoid multiple classes in one file unless nested or private.
- Minimal header includes: Use forward declarations where possible.
- Avoid circular dependencies: Especially between systems β use interfaces or weak references.
A clean C++ folder structure reduces confusion, speeds up compile times, and helps new developers (or future you) navigate the codebase with confidence.
Got your own folder strategy or engine module setup? Share it in the comments!