Tips for organize c++ code files?

Hi, i found that you can not create folders on Unreal Editor’s contents viewer like blueprint.

and if i try to organize my codes on Visual Studio by just create filter on solution explorer, it just get reset at some point.

So i want to ask some advanced unreal users that how they organize code files. so that i can organize my code files :slight_smile:

C++ classes in Content Browser is just for blueprint only users, more naturally you should use Class viewer in Window->Devlopment Tools->Class Viewer, it hsows class in inherence tree, blueprints included. You cna not change organization in content browser, because C++ classes are just virtual assets created on runtime, while other assets are uassets files which can be moved.

VS project is not needed for compilation, it only exist for you to open end edit files, it get regenerated if you right click uproject file and generate them, also class wizard in editor will trigger regeneration of project files. With regeneration all configuration in project gets overwritten back to default settings, thats why it resets.

There only 2 ways to organize cod filese:

  1. Stack them up in Source and module folder like default it does

  2. Make Public and Private folder inside it, Public should have header files that will be exposed outside of module, private should have all cpp files and header files to classes not exposed to outside of the module

thanks for detailed kind answer :slight_smile:

and i am sorry but i can’t get what ‘stack them up in source and modue folder like default it does’ mean.

you mean make folder inside Source folder like ‘make public and private folder inside’ and put files in it? or is there any way to stack up files?

Simply close everything, go to file explorer, make your sub folders and move files arround.

Here some exemple of folders i use

Dynamics
  traps
  logic
  gameplay
Units
  player
  enemies
UI
 Menus
 HUD
Wolrd
 Special(thing that extend some pluggings)
User (profiles/option)

Then right click on your upluggin file and select regenerate vs files
Open vs solution and try to rebuild => it will fail
Fix all includes as you moved files ( thats why there is no “drag &drop” in UE/vs )

Once it build, your are set :slight_smile:

1 Like