Blueprints derived from c++ classes not updating properly

Branch: Binary

Build Version: 4.10.0-2758231

Description:
It seems that in some cases blueprints are not getting updated after hot-reloads (or their variables are not initialized to accommodate new variables or changes in existing ones) This is mostly noticeable when adding methods to OnComponentBeginOverlap via AddDynamic(…) (and I believe this is true for other events too), and I’ve got some weird behavior with default subobjects a few times too. I haven’t been able to come up with any reliable way of reproduce described behavior, even though I’ve come across this issue multiple times during past few days.

In the case with subobjects becoming null, output log had something about serialized properties being NULLed during hot-reload. However, even while log stated that object was re-instantiated successfully, ubobject was null without any way of recovering. Bug seems to be similar to this bug report: link

As a workaround, issue can be fixed/avoided by simply renaming the variable each time the class is changed, but it gets annoying quite quickly.

Bug with the AddDynamic(…) is described here: link. However, the strange part is how this seems to happen seemingly at random, thus making debugging these issues a horrifying mess, especially if large quantities of newly written code is involved.

**EDIT: **

Further trying to investigate this issue, I still haven’t been able to find a reliable way of reproducing the behavior, at least not in a fresh project. In existing project however, every time a new UPROPERTY is added (or removed) to certain classes, existing references to those classes are getting NULLed during hot-reload, and new instances are not getting instantiated. The only way to generate a new instance is either re-create the blueprint or to rename the property containing the reference to the NULLed component.

According to logs, it seems that serialization is treating the class as a new class after adding/removing the UPROPERTY.

LogClass: Could not find existing class ProjectileSpawnerComponent in package /Script/coOP for HotReload, assuming new class

After which hot-reload proceeds as expected, until:

LogHotReload: Re-instancing coOPCharacter after hot-reload.
LogProperty:Warning: Serialized Class /Script/coOP.ProjectileSpawnerComponent for a property of Class /Engine/Transient.HOTRELOADED_ProjectileSpawnerComponent_2. Reference will be NULLed.
    Property = ObjectProperty /Script/coOP.coOPCharacter:ProjectileSpawnerComponent
    Item = ProjectileSpawnerComponent /Game/coOP/Blueprints/Characters/BP_coOPCharacter.Default__SKEL_BP_coOPCharacter_C:ProjectileSpawner
LogProperty:Warning: Serialized Class /Script/coOP.ProjectileSpawnerComponent for a property of Class /Engine/Transient.HOTRELOADED_ProjectileSpawnerComponent_2. Reference will be NULLed.
    Property = ObjectProperty /Script/coOP.coOPCharacter:ProjectileSpawnerComponent
    Item = ProjectileSpawnerComponent /Game/coOP/Blueprints/Characters/BP_coOPCharacter.Default__BP_coOPCharacter_C:ProjectileSpawner
LogHotReload: Re-instancing ProjectileSpawnerComponent after hot-reload.

As additional notes, UProjectileSpawnerComponent is a UActorComponent and is added via CreateDefaultSubobject<>(…) to the AcoOPCharacter. Nothing special, that is.

What comes to the other part of the issue (Events and AddDynamic(…)), it seems to have vanished, as I haven’t been been able to reproduce it anymore.

1 Like

Hey ASDSausage-

The posts that you linked are from past engine versions and have been resolved or require additional information to investigate. If you have specific instances of these issues occurring please provide any information that would allow us to test/reproduce on our end.

Cheers

I was having this issue in 4.13 after adding OnComponentBeginOverlap.AddDynamic(…) to a component. I was able to solve it by

  1. OnComponentBeginOverlap.AddDynamic(…)
  2. Saving and closing UE4 editor
  3. Navigating to my project root in windows explorer
  4. Deleting both the Binaries and Intermediates folders
  5. Right clicking on the project file and regenerating Visual Studio project files like so

Then opening the project file, which will force a rebuild. After that it all works, I just can’t touch the AddDynamic function or it will break again.

This issue persists in 4.18.3.

Steps to reproduce:

Create a UGameInstance c++ subclass

Add a UPROPERTY

Create a BP based upon the c++ class

Assign a value to the property

Modify the UPROPERTY (change the name or type, etc)

BP will not reflect changes, including new BP created from this c++ class