Description

A TMap containing a struct with a UObject reference property (set to nullptr by default) does not serialize properly for an instance where the UObject reference is set on the instance, but the TMap has the same number of elements as the default TMap. If the UObject reference is null, or the TMap has more (or fewer) elements than the default TMap, the TMap will be serialized correctly.

In the repro above, the EventGraph compares the name of the instance in the level to the contents of TheString in the first element of the TMap. If the values are the same, the contents of TheString will be displayed in green. If they are different, the text will be red. This works as expected in the first three instances. In the fourth instance, the text that is displayed is the default contents of TheString instead of the actual contents set in TheString for that instance.

There appear to be four key requirements for this issue to occur:

  1. The TMap contains a UObject reference.
  2. The UObject reference is null by default.
  3. The instance containing the TMap in the level must have set the UObject reference in the TMap to be valid.
  4. The TMap must have the same number of elements as the default TMap.

If any of these four requirements are not met, the TMap appears to serialize fine.

Steps to Reproduce
  1. Download the attached project (created in the Main stream at CL 4258917).
  2. Build the project in Visual Studio.
  3. Open the project in the Editor.
  4. Create a new Blueprint from the MyActor class.
  5. In the new Blueprint's Event Graph, create the setup shown in the attached EventGraph screenshot.
  6. Place four instances of the Blueprint into the level.
  7. Set up each instanced based on one of the attached Instance screenshots. Note the changed name of each instance as well as the settings for the TMap variable.
  8. Start PIE and look at the location for each instance.

RESULT:
The first three instances will show green text, and the fourth instance will show red text.

EXPECTED:
All four instances will show green text.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-62695 in the post.

2
Login to Vote

Fixed
ComponentUE - Foundation - Core
Affects Versions4.19.24.20.14.21
Target Fix4.22
Fix Commit4343728
Main Commit4772220
Release Commit4862694
CreatedAug 8, 2018
ResolvedSep 5, 2018
UpdatedFeb 12, 2019
View Jira Issue