'Is there an ideal project structure for a Unreal Engine 4 C++ Project? [closed]
This is a very broad question, but I have been developing in Unreal Engine for a while now and have always maintained the default project structure of having a main Public directory for the header files and having a main Private directory for the cpp files. It would look like this:
Figure 1
GameCore
├───Private
│ ├───Abilities
│ ├───Components
│ ├───Core
│ ├───Debug
│ ├───Game
│ ├───Interactives
│ │ └───Ammo
│ ├───Player
│ └───UI
└───Public
├───Abilities
├───Components
├───Core
├───Game
├───Interactives
│ └───Ammo
├───Player
└───UI
With that being said, I was looking through the source code of Unreal Engine and Blender and they both seem to organize their projects differently. For example:
Figure 2
GameCore
├───Core
│ ├───Private
│ └───Public
├───Debug
│ ├───Private
│ └───Public
├───Game
│ ├───Private
│ └───Public
└───Player
├───Private
└───Public
Are there pitfalls of choosing one structure over the other? I'm looking for concrete issues such as scalability and maintainability.
For example: I'm finding that with Figure 1 the #include statements are shorter i.e.
#include "Player/CCharacterController.h"
Whereas Figure 2 the #includes look like
#include "Core/Player/Public/CCharacterController.h"
Solution 1:[1]
This is one of those instances where "form vs function" comes into play.
Unreal includes a C# build system to simplify and unify the build process.
The theory behind the longer paths is: at compile time all of the relevant files are included through the C# build file.
There is nothing wrong with your approach, even if it differs with certain projects. It is simply a design decision.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Strom |