New elements are not being initialized properly when setting up the default value for arrays of user-defined structures in nativized Blueprint C++ constructor code.

Steps to Reproduce
  1. Create a new, blank Blueprint-only project.
  2. Add a new User-Defined Structure (MyUDS) and open it in the UDS editor.
  3. Change the type of the member variable to 'Texture2D' and rename it to 'Texture0'.
  4. Save and close the UDS editor.
  5. Add a new Actor-based Blueprint class (MyBP) and open it in the BP editor.
  6. Add a new variable and change its type to 'MyUDS'. Also change it to an array.
  7. Compile, and then add a new array element to the default value in the Details tab.
  8. Compile, save and close the BP editor.
  9. Drag an instance of MyBP into the current map and save it (NewMap).
  10. Choose Edit->Project Settings, and under "Maps & Modes" set the Game Default Map to 'NewMap'. Also under "Packaging" change Blueprint Nativization to 'Inclusive'.
  11. Choose File->Package Project->Windows->Win64, select a folder and wait for packaging to finish.
  12. Launch the packaged game. After load, press the <TILDE> key to open the console window and type 'obj gc'. Note that a crash will result:
[2018.02.28-14.36.25:761][613]LogWindows: Error: === Critical error: ===
[2018.02.28-14.36.25:761][613]LogWindows: Error: 
[2018.02.28-14.36.25:761][613]LogWindows: Error: Fatal error: [File:F:\dev\Epic\UE4\Release-4.19\Engine\Source\Runtime\CoreUObject\Private\UObject\GarbageCollection.cpp] [Line: 579] 
[2018.02.28-14.36.25:761][613]LogWindows: Error: Invalid object in GC: 0x0000024304f30d98, ReferencingObject: MyBP_C /Game/NewMap.NewMap:PersistentLevel.MyBP_10, ReferencingObjectClass: DynamicClass /Game/MyBP.MyBP_C, Property Name: Texture0_2_7DD2E46340D30926ED55EC8C9E5A673B, Offset: 0, TokenIndex: 23

Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-55628 in the post.

Login to Vote

ComponentGameplay - Blueprint
Affects Versions4.19
Target Fix4.19
Fix Commit3920519
Main Commit3990065
Release Commit3920519
CreatedFeb 28, 2018
ResolvedMar 2, 2018
UpdatedOct 3, 2019