Why do I have to build the Engine every time I change a little piece of code?

Title says it.

I change a little line of code and PUFF! I have to build the whole engine all over again, just to be greeted with a compile error.
I correct the Compile Error and PUFF! I have to build the whole engine all over again, just to be greeted with a compile error.
I correct the Compile Error.

I add new lines of Code and PUFF! I have to build the whole engine all over again, just to be greeted with a compile error.
I correct the Compile Error and PUFF! I have to build the whole engine all over again, just to be greeted with a compile error.
I correct the Compile Error and PUFF! I have to build the whole engine all over again, just to be greeted with a compile error.
I correct the Compile Error and PUFF! I have to build the whole engine all over again, just to be greeted with a compile error.
I correct the Compile Error and PUFF! I have to build the whole engine all over again, just to be greeted with a compile error.

(Repeat until no energy left)

Time wasted: Years, even centuries.

FYI: I press Build, not Rebuild.

1 Like

I am using vs 2015 update 3 with the default configuration from unreal, if I change something it only compiles that module,which is fast enough for me, did you change something in your config?

What are you changing? Some core headers can require a full rebuild, but generally it should only compile the changed files.

Do you mean rebuild the engine? Or rebuild the game project?

You should not have to rebuild the engine whenever you change game project files. Only your games module gets rebuilt.

If you are using a custom engine build, and working on a team, make sure to configure an InstalledBuild. This avoids you having to compile the engine for changes.

It’s a bug in the UBT.

What you can perhaps do is to manually clean up your project first by deleting the binaries, intermediate and maybe the saved folder too , as well as the .vs folder along with the sln and db files, then go into your ue4 solution folder press generate project files, and build the engine again. Close the ue4 solution, then you can go back to your project folder, generate the project files from the uproject, open it then build the game solution, it should allow you to build the project without recompilation of the engine (you will get “up to date” for the shader, header tools) and from there you will very likely to have a working build tool again.

In the very unfortunate case this would not fix your issues, you will delete the engine in its entirety and check out again from git, build the engine, then you can repeat this manual project cleanup before generating, opening and building it. After all this terrible process it gets resolved for sure, unless you have had some very unusual issues in your engine modifications or project which i have never met before.

It always help me as the last resort. Good luck!

I only want to change the GameModeBase.h and maybe it’s cpp. I don’t think it’s entangled in the whole Engine…

Do you really need to change the GameModeBase? Wouldn’t it be easier to extend your own class from it and then just compile the game module?

I want to expose Functions to BP.

try post #5 and see if that applies for you

Disable unity build in UE4 - unity build is great if you want to improve UE4 build time but it does come with cons - which is a slight change in one cpp will result into a big compilations involving other unrelated cpp files. But I do think your problem is different, probably file time stamp is not written correctly.

Are you using VS 15.3? Maybe this bug is related? https://answers.unrealengine.com/questions/701669/unchanged-modules-relinked-every-single-build-usin.html

It’s your own fault in my opinion… If you are changing the engine code and hitting build without any sort of regard for the code you write, and you are getting errors, and you repeat the cycle, then you don’t understand how to program in large code bases in C++. You have to realize that the code base is over 2 million lines of code. Of course its going to take awhile when compiling. So because of this, you need to understand what your code is going to be doing before you write it and far before you hit that build button. Stop expecting your code to work. Pay attention to what your writing and think about what your doing and how your doing it. It’s obviously much more nuanced than just hitting some keys and expecting it to compile. When programming in C++ you have to think like a compiler or else you will suffer like this.

It’s simple really, stop hitting build haphazardly… and actually think about what your doing and how your doing it…

GameModeBase is definitely engine code, so yes you have to rebuild the entire engine anytime you modify anything in the engine code. Even if its just adding a simple semicolon.

No, you should only have to compile the single module that file is in.

It should, but it doesn’t always happen. C++ compilation is complicated. Especially when talking about a large code base.

I should have been more clear in that it would compile the module but it might just compile everything.

Here is possible solution:

Don’t change GameModeBase!

Create a new GameMode that inherit from it…