Download

Completely disable hot reload system

Is it just me or is hot reload way too buggy to be useful?

I change 1 line of code, making types binary incompatible or something. I close the editor before or after every compile, clean project, build project, open editor, sometimes it works, if it doesn’t I’ll hit compile in editor, sometimes it works, generate project files, refresh visual studio project, recompile, and then after like 15 steps things will start working again.

So my question is there a way to disable hot reload from caching whatsoever? It’s a nice feature when it works, but once you start going beyond simple stuff it really gets in the way.

You have to get a feel for the things you can do with a hot reload. For example, when you don’t make any changes to header files (i.e. haven’t declared new class member variables, or added/removed/changed function signatures) hot reload works quite well. That’s mostly how I use it and I have based my workflow around it: plan ahead and set up the header file. Then compile and boot the editor. From that point, as long as your header file doesn’t require changes you can change function implementations and hot reload as often as you want (generally).

About those long list of steps you’re doing, its way overkill (and not useful) to do that on every change. For example the project files only affect your Visual Studio environment, but don’t actually matter for the game, because UnrealHeaderTool which compiles your game simply processes all source files. So here is when to do what:
You just want to change a function implementation? Hot reload will work in most cases.
You added/removed/changed functions or variables outside a function? Close editor and recompile.
Your Visual Studio solution file list is out of sync with your actual Source folder? Generate project files.

Clean project helps if your project doesn’t compile while it should, for example if the game dll is out of date, but the compiler doesn’t recognize this. This can happen if you keep coding while the game dll is compiling. :stuck_out_tongue:

I understand all that, but even closing the editor, making your changes, and doing a cleaned compile, it still uses the old binaries when you first reload. I have to do that dance in order to get it to sync.

Excuse me for unrelated question. But how hot reload works? For example:

  • Ball’s initial position = 0
  • Ball’s speed currently 10m/s
    I run game for 5 sec, the ball moved 50m so far.
    After that I alter the speed from C++ editor, make the speed 20m/s
    After the code finished compiling, how the game supposed to react?
  • The ball return to position 0, then moving with speed of 20m/s
  • Or the ball continue from position 50, then moving with speed of 20m/s
  • Or the ball recalculate it’s position, and end up at position 100.

If you make a change and compile your project after closing the editor, UnrealBuildTool should automatically delete old hot reload files. One thing to be aware of if you compile after closing the editor is you need to make sure UE4Editor.exe isn’t still running because it stays there for a few seconds to a minute or two to clean up memory and unload modules and if UBT detects that the process is running, it will trigger a hot reload compile instead of a regular compile.

To completely disable hot-reload system set WITH_HOT_RELOAD define to 0 in Engine/Source/Runtime/Core/Public/Misc/Build.h and rebuild the engine.

PS. Requires source code version of UE4.

The simulation will start over, with the ball at position 0. If you’re lucky and hot reload worked, 20m/s.

I will try this, thanks!

This isn’t a direct answer, but for me it is a better one, maybe it will also be for you :slight_smile:

Instead of compiling Development Editor, compile DebugGame Editor, and only run editor from VS using F5 (Debugging).

It can not hot reload while doing this. Any errors that occur will give you all the debugging information and access to all the values of your variables which makes solving stuff far easier and more informative.

It is my preferred workflow, but I think possibly it is slower for some people however I run on Samsung 950 which is ~4x faster read speed than regular SSD so can’t say for certain.