Overview
Proper asset organization is crucial for maintaining a clean and manageable Unity project. This page outlines the conventions used in PlatformerGame for organizing and naming asset files and directories.Naming Conventions
Directories
Directories are named using TitleCase:Files
Files are named using TitleCase:Organization Principles
Resource files are organized following these key principles:- Context and Usage: Assets are grouped by their context and usage in the game
- Loading Requirements: Data that needs to be loaded together is grouped together
- Descriptive Names: File names should clearly indicate what the asset is and where it fits in the game
Just by reading the name of a file, you should be able to know what it is and where it fits in the game.
Directory Structure
The following structure is used throughout the project:Audio Assets
- Audio/Fx: Sound effects used during gameplay
- Audio/Music: Background music tracks
Visual Assets
- Screens/: Screen-specific assets organized by screen name
- Sprites/: Game sprites and character graphics
Common Assets
- Common/: Shared assets used across multiple screens (fonts, GUI elements)
Some resources require to be loaded all at once while others require to be loaded only at initialization (gui, font).
Asset Loading Considerations
When organizing assets, consider their loading requirements:Screen-Specific Assets
Assets loaded and unloaded per screen
- Background images
- Screen-specific UI elements
- Level-specific sprites
Persistent Assets
Assets loaded once at initialization
- Fonts
- GUI elements
- Common sound effects
Example Structure
Here’s a complete example of how assets might be organized in a typical level:Best Practices
Use Descriptive Names
Use Descriptive Names
Choose file names that clearly describe the asset’s purpose:
- Good:
EnemySlime.png,LongJump.wav - Bad:
enemy1.png,sound2.wav
Group by Context
Group by Context
Keep related assets together based on when and where they’re used:
- Screen-specific assets go in
Screens/[ScreenName]/ - Character sprites go in
Sprites/ - Sound effects go in
Audio/Fx/
Avoid Special Characters
Avoid Special Characters
Never use spaces or special characters in file names:
- Good:
MainTheme.ogg,PlayerJump.wav - Bad:
Main Theme.ogg,Player-Jump!.wav