Hot reload bug (with REPRO EXAMPLE)

You tried remove “config=Game” from class’es definition macro UCLASS(config=Game)?

tested on 4.11-p4 and 4.10.2

I know an easily reproducable bug related to Hot Reload not reloading fully. Althougth it looks like wall of text, its very descriptive, to reflect my experience more precisely. Steps to reproduce it:

  1. Create C++ FirstPersonShooter template project
  2. Open VS 2015 if it is not open
  3. 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).
  4. second code change (recommended) - comment or delete the “Destroy();” from next function (it will be 10 lines of code lower in samme file)
  5. in my case i also commented in Character.cpp 4 lines that are below the “// try and play the sound if specified”
  6. Now you can save all files in VS 2015, and do UE Reload or VS Build.
  7. 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).

If its not reproducable for you, post here, so i will tell even less important details.

from projecile.h? it did not help.

a working workaround is to play as standalone game (play option from UE toolbar), so, unlike PIE, standalone mode reloads properly.

update:
Btw, even switching between PIE and Standalone modes, Projectile despawn time (aka InitialLifeSpan) is different, easy to reproduce
(tried with removed “config=Game”)

In example, if i change “InitialLifeSpan” to 1 second, after Compiling, if i play PIE, despawn time is 3 seconds, when i switch to Standalone mode, despawn time is properly 1 second, then i swith back to PIE in viewport and Despawn time is 3 seconds…

Hello Saah88,

Thank you for reporting this issue. This seems to be related to the construction script itself as I tested setting the same variable to 5.0f in the “OnHit” function and then changing the value to 10.0f with hot reload and it changed as expected. I’ve placed a bug into our system under the number UE-26273. In the meantime, the only workaround I can suggest is simply not using hot reload. Unfortunately, the only other option would be to not set things in the construction script. OnConstruction could be an alternative.

Have a nice day!