Why is it not possible to create folders unless you set a Class to public?

Hello! You can do it like this

  1. Choose folder
  2. Right button click
  3. Create
  4. Folder

After folder is created just use OS Dialog to choose it.
You also can reset Public|Private by reselecting in OS Dialog root folder of Project source

2 Likes

When creating a new C++ Class in the default “C++ Classes/ProjectName” folder I encountered several problems:

  • You can’t create folders by right clicking like you can do in the rest of the content browser, i’ve seen old tutorials on youtube where this option was enabled

336742-righclick.png

  • You can create a class inside a folder by adding a custom path but it won’t appear in the editor even if you restart it! The message log will say "Cannot open include file: “Actors/MyActor.h” : No such file or directory
    If you delete the binaries folder it fails to recover and says "Project could not be compiled. Try rebuilding from source manually"
    If you do it manually visual studio will say "Cannot open include file: “Actors/MyActor.h” : No such file or directory
    So, you have to force delete all those files in a subfolder that’s not “Public” or “Private”, otherwise you won’t be able to reopen your project

  • If you create a class you can only place it in a subfolder if you set it to public in the top right corner you won’t be able to set it back to null and every class you create from now on will go in the public or private folder (even if you change the path manually), the option will remain yellow and I haven’t been able to find a way to deselect it:

2 Likes

Thank you for your answer, I already tried that as you can see from the second picture, I tried it again and it doesn’t work, I’m getting the same compile error.
Selecting the root folder of project doesn’t work too, tried both on a new project

2 Likes

If you have compile errors then you project content folder doesnt update! So you should firstly fix copilation and after that you content folder will refresh…

Compilation errors are caused by the class creation and the only way to resolve them is deleting the class just created, so… No, that’s not the problem.
It’s a new empty project and everything compiles fine until you create the class (try to believe)

4 Likes

I solved this commenting a row in the ProjectName.Target.cs and ProjectNameEditor.Target.cs:

DefaultBuildSettings = BuildSettingsVersion.V2;

Apparently if you use Build Settings Version V2 it doesn’t read files outside the Public/Private folders but I guess this is not a real solution (I wasn’t able to find what this version does but I think it should have some improvement)

Another solution is to fix all headers to include files otherwise not considered by the new build system (Introduced in 4.24), I found a script to do it automatically here:

4 Likes

I am a bit late to this party. But I also got wondering why we cannot arrange our C++ files into folders using the editor. Ultimately, I wanted to create a UI/Menu system that I can easily copy/import and use in other projects.

I also ran into all the problems you mentioned once I tried to make my own folders (by editing the string in the Class Creation dialog).

Eventually I have discovered “modules”: Unreal Engine Modules | Unreal Engine 4.27 Documentation

I think this is linked to the folder thing, because you have to manually create a folder with the name you wish your module to be called and it has to live in the ‘Source’ folder.

I haven’t fully implemented a module yet, but it seems they are ideal for making re-usable code

1 Like