Skip to main content

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:
Assets/Sprites
Assets/Fonts
Assets/Audio
Assets/Screens

Files

Files are named using TitleCase:
MainTitle.png
Cubicmap.png
CoinFx.wav
Player.png
Spaces and special characters MUST BE ALWAYS avoided in files/directory naming!

Organization Principles

Resource files are organized following these key principles:
  1. Context and Usage: Assets are grouped by their context and usage in the game
  2. Loading Requirements: Data that needs to be loaded together is grouped together
  3. 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

Assets/Audio/Fx/LongJump.wav
Assets/Audio/Music/MainTheme.ogg
  • Audio/Fx: Sound effects used during gameplay
  • Audio/Music: Background music tracks

Visual Assets

Assets/Screens/Logo/Logo.png
Assets/Screens/Title/Title.png
Assets/Screens/Gameplay/Background.png
Assets/Sprites/Player.png
Assets/Sprites/EnemySlime.png
  • Screens/: Screen-specific assets organized by screen name
  • Sprites/: Game sprites and character graphics

Common Assets

Assets/Common/FontArial.ttf
Assets/Common/Gui.png
  • 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:
Assets/
├── Audio/
│   ├── Fx/
│   │   ├── LongJump.wav
│   │   ├── CoinCollect.wav
│   │   └── PowerUp.wav
│   └── Music/
│       └── MainTheme.ogg
├── Screens/
│   ├── Logo/
│   │   └── Logo.png
│   ├── Title/
│   │   └── Title.png
│   └── Gameplay/
│       └── Background.png
├── Sprites/
│   ├── Player.png
│   ├── EnemySlime.png
│   └── Coin.png
└── Common/
    ├── FontArial.ttf
    └── Gui.png

Best Practices

Choose file names that clearly describe the asset’s purpose:
  • Good: EnemySlime.png, LongJump.wav
  • Bad: enemy1.png, sound2.wav
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/
Never use spaces or special characters in file names:
  • Good: MainTheme.ogg, PlayerJump.wav
  • Bad: Main Theme.ogg, Player-Jump!.wav

Build docs developers (and LLMs) love