Cheats to circumvent long compile times

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?

I’m on 4.15,
Thank you.

Are you using a Source build from github or a binary engine from the launcher?

Just the default engine and adding a few c++ classes from that.

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:

MinFilesUsingPrecompiledHeaderOverride = 1;
bFasterWithoutUnity = true;

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.

It only uses unity build for large game projects by default (with dozens of files) so that probably changes nothing.

Also takes about 10-20 seconds to compile one change in a cpp file for me.

Yeah that doesn’t seem to do much for my project either… good to keep in mind for the future though, thanks.

It takes 5- 20 seconds for a change for me, I find this quite acceptable to be honest

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.

Get an SSD if you have not got one yet.

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.

Ah I see. Thanks, I’ll keep that in mind.

And I’m running an SSD yes, it’s pretty frigging fast one too… :slight_smile:

I wonder if this is related to the VS 2017 update I installed yesterday, but compiling a change in a single file only takes 1-2 seconds now.