Hot reload buggy sometimes?

Hi,

I have been working with C++/Blueprints project and recompile my source files a lot. And I have noticed that sometimes things not going well after hot reload. It’s hard for me to investigate when this is happening, so here is just what I saw:

When I edit properties of blueprint that was inherited from my C++ class, values may not be updated inside (and game PIE test stuck with default valued that was set in C++ class), transform nodes on SceneComponents may disappear or even whole component may become inaccessible via blueprint. I have also noticed bug with collision system - it sometimes just stop working for actors that was placed in a world. There are more minor glitches, that I cant explain well (like particle system just stop updating). All this for objects, that was inherited from hot reloaded C++ code.

Usually all this can be fixed by simply reloading editor or cleaning up solution and rebuilding my sources. But sometimes I need to remove actor from a world and set it again or recreate a BP just because I made a minor update in my code :confused:

I’m not sure, if this are limitations of hot reload or some bugs?

Basically, hot reload reloads your modules, but it doesn’t always do it properly. Some functions pointers aren’t updated and so on. Just don’t use hot reload. And, if you do, save everything first and be prepared to restart the editor straight away if things go wrong.

The question why it is acts like that? I mean if this feature exists it should (theoretically) work well, no? :slight_smile:

Maybe there is some good article about hot reload and potential situations when it may work not as expected? Knowing that will help me optimize my workflow and save my time not seek bugs in my code that actually hot-reload issues =)

Just don’t hot reload. That is how you speed up your work flow. It takes no time at all to restart the editor in 4.10.

“Don’t use hot reload” is not too helpful advice for solving your problem. If hot reloading is not working correctly for you, something is wrong with your project. Hot reloading works just fine for me in several medium-sized projects (100+ source files, thousands of lines of code), except when I make changes which are obviously impossible to reconcile without restarting the editor (class definitions changing for in-memory and referenced objects, etc.).

There is probably something wrong with your code that can be changed to make hot reloading work. It’s easy to make mistakes with initialization and state/property things if you are still becoming familiar with it. If you have anything you suspect is causing problems, feel free to post it and I will try to help you.

But remember that hot reloading isn’t actually magic. If you have editor windows open that are referencing objects that you change the definitions of in C++, and then you perform a hot reload, the editor keeps the old objects/code around for those objects.

1 Like

Hot reloading work correctly for me in most cases. I have a pretty small mobile game project, and there is nothing super complex that could potentially be the issue. Just some C++ classes for actors and components, that I use as base for Blueprints.

I am most worried about the fact that sometimes editor reloading, solution and binaries cleaning not helping. For example:

  1. I have C++ class.
  2. I have blueprint, inherited from it.
  3. I set this blueprint actor in world.
  4. I modify my parent C++ class several times. Nothing super destructive, just tweaking some code.
  5. After some iterations this blueprint actor in the world could stop updating particle system component. Or stop react on ray casts. And solution cleaning or editor reloading not fixed it. But if I delete this actors and put them in world again - they begin work fine. And this is frustrating for me. Does things placed in the world become split form original source class in some way?

I’m sorry if I’m saying or asking something stupid, I just trying to figure out how all this stuff work.

It’s easy to make mistakes with initialization and state/property things if you are still becoming familiar with it.

This is not the only reason hot reload will fail. Far from it. There are numerous issues with it, which will cause (effectively) random errors to pop up in your project if you use it. Sometimes you are lucky and they don’t happen. Sometimes it will cause catastrophic failure, such as disappearing nodes or bp links, bp functions not updating correctly, etc., which only restarting the editor will fix. Most of the time you probably just don’t notice the issues.

I have a large project (~1000 source files) and if I hit hot reload, bad things happen, always.

That might be true! I don’t use a significant amount of Blueprint scripting, so it’s possible that there are problems which arise from hot reloading and Blueprint code.

Hmm, that’s definitely not good behavior. Even if hot reloading is not working for you, you definitely shouldn’t have to modify your saved maps after modifying C++ source, unless you’ve made some kind of breaking change.

If you can reproduce it or show a specific example, I might be able to help you with it.

Thank you for your answers guys, you gave me some food for thought.
Unfortunately, I can’t reproduce my situations with just only setup. It’s occur sometimes after modifying the source in my working project. If I figure out better when it happens, I will post here.

Hello ,

While Hot Reload is a very useful tool for workflow, it is not infallible as both and cancel have mentioned. Whenever you have some reproduction steps for your hot reload problems, I’ll be happy to look into the issue for you.

I think now I better understand hot-reload behavior and when I can rely on it. This topic can be closed as resolved. All problems was in my misunderstanding.

Thank you for all your explanations!

I know an easily reproducable bug (not related to saved on level actor, its different issue). Althougth it looks like wall of text, its easy very descriptive, just to reflect my the experience precisely. Version is 4.10.2, steps to reproduce it:

  1. Create C++ FirstPersonShooter template project
  2. Open VS 2015 (in my case step-1 has failed “windows.h”, work-arounded, then delayimp.lib workarounded aswell (both fixed by modifying project setting “VC++ Drectories”, btw)
  3. since step1 failed, i begin with Build (thorough right-clicking ProjectName in VS 2015 > Build)
  4. close the “New project wizard” if it is still opened and Run your project from Launchers Library to open Unreal Editor
  5. In the source file ProjectNameProjectile.cpp modify “InitialLifeSpan = 3.0f;” to a different value, (better to use values, that are easier to distinguish, so either set it to 1.0f, or to 8.0f and higher, since you will have to manually count seconds in PIE to ensure, that this code-edit works).
  6. second code change (recommended) - comment or delete the “Destroy();” from next function (it will be 10 lines of code lower in samme file)
  7. in my case i also commented in Character.cpp 4 lines that are below the “// try and play the sound if specified”
  8. Now you can save all files in VS 2015, right click your ProjectName and “Build” and wait untill yo see “========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========” (btw, i do not click “compile” from Unreal Editor because it ofter fails with “DelayImp.lib” even after VS project settings were fixed by known workarounds)
  9. Finally, Play in Editor (PIE), when shooting, you can see, that sound is disabled (as intended), projectiles hitting movable boxes dont despawn, when they hit them (as intended), but projectile despawn time still remains ~3 seconds (as NOT INTENDED), to see proper “InitialLifeSpan” variable’s effect, you have to reopen your project in Unreal Editor (which will restart the Unreal Editor).

i will repost my mesage as a new bug report

upd:
new bug report done.