Preforming a hot reload causes placed actors to lose code based variable settings.
More repro steps:
1. Open UE4Editor.exe
2. Create a First Person Code project
3. Build the project for Development Editor Win64 in Visual Studio
4. Open UE4Editor.exe
5. Open the built First Person Code project
6. Select File > New C++ class > Actor > Next
7. Select Create Class to create a new class based on Actor called MyActor
8. Select File > New C++ class > Show All Classes
9. Search for MyActor and select it
10. Select Next > Create Class to create a new class based on MyActor called MyMyActor
11. Add the following code to the public section of MyActor.h (line 26)
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test) AMyActor* MyActorPtr; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test) float RandomNum;
12. Close UE4Editor.exe
13. Build MyProject for Development Editor Win64 in Visual Studio
14. Open the First Person Code project back up into UE4Editor while leaving Visual Studio open
15. Select View Options > Show C++ Classes in the content browser
16. Locate the MyActor and MyMyActor classes in the content browser
17. Drag the MyActor and MyMyActor classes from the content browser into the viewport
18. Select MyActor from Scene Outliner (MyActor1)
19. Set MyActorPtr to MyMyActor1 and RandomNum to 5
20. Switch back to Visual Studio and open MyActor.h
21. Rename RandomNum to RandomNum2
22. Compile the template project for Development Editor Win64 in Visual Studio
23. Switch back to UE4Editor and select MyActor1 in the World Outliner
24. Locate the MyActorPtr and RandomNum2 properties in the Details panel for MyActor1
RESULT:
MyActorPtr is set to None
Expected
The MyActorPtr of MyActor1 is still set to MyMyActor1 after hot reloading
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test)
AMyActor* MyActorPtr;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test)
float RandomNum;
Result:
MyActorPtr for MyActor1 is reset to none and RandomNum2 is reset to zero after the hot reload.
Expected:
The variable values remains after the hot reload.
Head over to the existing Questions & Answers thread and let us know what's up.
345 |
Component | UE - Foundation - Cpp Tools - Hot Reload |
---|---|
Affects Versions | 4.17.2, 4.18, 4.19, 4.23 |
Target Fix | 4.26 |
Created | Nov 9, 2017 |
---|---|
Resolved | Jun 24, 2020 |
Updated | Sep 6, 2020 |
5830 - Algorithman |