Hey, I’m just starting to work with c++ in Unreal and was wondering if there are ways to skip the rather long (in my case 10-20 seconds right now which is already getting frustrating, I assume others have much longer) compile times to test things?
For instance, can I compile single classes? Is there anything else maybe one can do?
Yeah, you can speed up the C++ build times for a game project or plugin project. By default, the Unreal Build Tool will lump all source files together into a single combined .cpp file and compile that all at once. That means that even a tiny change in a single source file will trigger a rebuild of the entire project source. You can change this behavior by adding the following two lines to your project’s .Build.cs file:
Just put those in the C# constructor, right above the “PublicIncludePaths” line. This will force UBT to compile each source file individually, much like a Makefile would do, and can speed up your compile times tremendously.
I think if I was more comfortable writing c++ for UE then I miiiight be able to agree… but on the other hand I’m pretty fluent in Python for various applications and it would be frustrated waiting 20 seconds to try to run that. If you’re doing error prone large algorithm things it can quickly get tedious to wait. Of course c++ is a different thing but still… just seeing if there are ways to speed things up.
It’s hard to bring compile times below the 20 seconds mark. Avoid changing .h files too often as that causes a recompilation of more files than just changing a .cpp file.