Unity Project Structure

Unity3D is a powerful suite of tools (Project IDE, Code IDE, and run-time) for game development. Unity supports several languages, but the community consensus is to use only C#. Having good coding standards and an established project structure is beneficial to your project and your team.

See my Coding Standards for C#.

Pros of Project Structure

Regardless of which convention you choose to use for Unity or other platforms, having a solid project structure is considered a good idea by the majority of the development community. A hallmark of Getting Things Done efficiently is to automate what can be automated. Once a team has standards and project structure and adopts them (both admittedly time consuming) the time improvements in the daily workflow are notable. There is less discussion on why or how to name things. It just gets done.

  • Consistency – The project structure has consistency in presentation regardless of team location, spoken language, or individual programmers.
  • Maintenance – Consistent project structure will aid readability. Readability helps new and existing programmers revisit the code base for fixes and improvements.
  • Communication – Developers more implicitly understand each other in written and verbal communication.

Root Project Structure

  • MyProject
    • Assets
    • Packages
    • ProjectSettings

Assets Folder Structure

  • 3rdParty
    • [VendorName]
      • readme.txt (manually create & update with source URL and changelog)
      • [PackageName]
  • Art
    • Animators
    • AnimationClips
    • Fonts
    • Materials
    • Models
    • Shaders
    • Sprites
    • Textures
  • Audio
    • AudioClips
    • AudioMixers
  • Documentation
  • PhysicMaterials
  • Prefabs
    • RMC
      • [MyProject]
        • MyHeroPrefab (using MyHero.cs)
  • Presets
  • Resources
  • Scenes
  • ScriptableObjects
    • RMC
      • [MyProject]
        • MyHeroSettings (using MyHeroSettings.cs)
  • Scripts
    • Editor
      • RMC
        • [MyProject]
          • MyHeroEditor.cs (namespace RMC.MyProject)
    • Runtime
      • RMC
        • [MyProject]
          • MyHero.cs (namespace RMC.MyProject)
    • Tests
      • Editor
        • RMC
          • [MyProject]
            • MyHeroTest.cs (namespace RMC.MyProject)

FAQ

  • RMC represents my custom company name
  • MyProject represents the custom project name.
  • Art consolidates creative concerns. This makes it easier to onboard, commit, and police commits of the work related to the creative team.

References

Leave a Reply

Your email address will not be published. Required fields are marked *