Hi.
I have described the problem here:
https://answers.unrealengine.com/questions/716269/warning-reference-will-be-nullptred.html
now I think it is a bug, so I am reporting it here, with a way to regenerate it.
the problem is that some minor changes to base class may cause some pointers (of this class or its derived classes ) to be nullptred after build is done.
this happens onley in the current opened level.
other instances in other levels seems to be fine.
this happens when I get a warning like this one:
LogHotReload: Re-instancing MyActor after hot-reload.
LogProperty: Warning: Serialized Class /Engine/Transient.HOTRELOADED_MyActorDerived_2 for a property of Class /Script/test5.MyActor. Reference will be nullptred.
Property = ObjectProperty /Script/test5.MyActor:ptr
Item = HOTRELOADED_MyActorDerived_2 /Game/kk.kk:PersistentLevel.MyActorDerived_1
Steps to Reproduce this bug:
-
Launch the editor and create a new empty C++ project (Basic code).
-
Add a new C++ class derived from Actor (call it MyActor).
-
Modify MyActor.h to include the following in the class decleration:
public: UPROPERTY(EditAnywhere, Category = ttr) class AMyActor* ptr; UPROPERTY(EditAnywhere, Category = ttr) bool bValue;
-
Build the project in Visual Studio and wait for the UE4 editor to hot-reload the updated class.
-
Back in the UE4 editor, create a new c++ class derived from MyActor (call it MyActorDerived).
-
in UE4 Editor Create new Level (call it myLevel). open myLevel.
-
Drag an instance of MyActor class into myLevel (it is automatically called MyActor1).
-
Drag an instance of MyActorDerived class into myLevel (it is automatically called MyActorDerived1).
-
Select MyActor1 (from world outliner), go to Ttr category (in the object properities) click on Ptr and from the list choose MyActorDerived1 .
so now MyActor1::ptr pointing to MyActorDerived1 -
Save all.
-
Go to visual studio to MyActor.h. rename bValue to bValue2.
(this minor change to MyActor will produce the bug !) -
Build the project in Visual Studio and wait for the UE4 editor to hot-reload the updated class.
-
Back in the UE4 editor, select MyActor1 , you will notice that the pointer āptrā nullptred and lost its data (of Step 9) .
-
Open Output Log , you supposed to see the following warning:
LogHotReload: Re-instancing MyActor after hot-reload.
LogProperty: Warning: Serialized Class /Engine/Transient.HOTRELOADED_MyActorDerived_2 for a property of Class /Script/test5.MyActor. Reference will be nullptred.
Property = ObjectProperty /Script/test5.MyActor:ptr
Item = HOTRELOADED_MyActorDerived_2 /Game/myLevel.myLevel:PersistentLevel.MyActorDerived_1
this bug may cause big miss when level has many pointers , like our case. waiting for fix. Thank you.