I’m a bit confused about the project directory in Visual Studio.
For SideScroller, it appears as follows:
I’m a programmer, so I understand what each of those are, but why does the Classes folder only contain Character.h and GameInfo.h while the public folder contains only the SideScroller.h file?
I’d imagine that you would want to expose the .h classes as public, so why place them in the Classes folder? Is it so that they are accessible from within the Rocket editor?
This is a legacy folder structure specific to older versions of Unreal Engine. It used to be the case that class definitions of UClass classes (that derive from UObject or AActor, etc) had to be placed in the “Classes” folder, because that’s simply where our build tools looked for them.
We’ve recently worked to eliminate this requirement and allow these UClass definition files to be placed in the Public or Private folders instead, or no sub folder at all (in which case I believe they are presumed to be private). This change has not made it into the Rocket Beta yet, but it should come in either Beta 5 or Beta 6.
Thank you Joe, excellent response.
That’s what I figured as well. So going forward, I should keep the .cpp files in the private folder, and .h files in the public folder.
Now that I’m using the new flying template, I’ve come across a similar question:
I understand why the .cpp files are private.
What I’m confused about again is why there is one .h in Classes, and another .h file in Public.
Does it matter which folder they are in? I mean, is there anywhere in the classes that references the path to these files? Or can I place either of them in either folder and it really makes no difference?
FlyingPawn is a UClass because it derives from a class (Pawn) that derives from UObject. You’ll find a UClass definition inside of FlyingPawn.h, so it had to conform to special requirements for UClasses, one of which used to be that they needed the headers containing their definition to be in the classes folder. Flying.h is does not contain a UClass definition, so it didn’t need to be placed in that folder. You can see the difference by looking for “UClass” inside of each header. You will find it inside FlyingPawn.h, but not Flying.h.
But again, the “Classes” folder will be going away soon as we try to make UClasses not be such a special case, so you will at least not have to worry about that part anymore soon.
Thanks Joe, that explains it all. I appreciate the prompt response, especially so late in the evening.