Description

Adding an Actor Component that contains a TMap property to a Blueprint results in unexpected behavior when default elements of the TMap are modified in an instance of the Blueprint in the level:

  • Adding a new element, or deleting one of the default elements, results in all default elements being removed from the TMap.
  • Modifying the value of one of the default elements of the TMap results in all other default elements being removed from the TMap.
  • If one or more default elements are removed from the TMap and a new one added, the new element will be removed if it is given the same key as one of the default elements.

It would appear that all of these are related, so they were collected in a single ticket. These issues only seem to occur when the TMap property is added to the Actor Component class. The issues were not observed when a TMap property was added directly to an Actor class.

Steps to Reproduce
  1. Create a new Basic Code project.
  2. Add a new code class to the project that is derived from Actor Component.
  3. Add a TMap property to the new Actor Component class.
    • For example:
      UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = TestCat)
      TMap<FName, FVector> TheNewMap;
      
  4. Build the project in Visual Studio.
  5. Open the project in the Editor.
  6. Create a new Actor Blueprint.
  7. In the new Blueprint, add an instance of the Actor Component created in step 2.
  8. Add 2-3 default elements to the TMap in the Details panel of the Blueprint.
  9. Place an instance of the Blueprint in the level.
  10. Make sure the instance in the level is selected.
  11. Click on the Actor Component in the Details panel.
  12. Perform any of the following actions:
    1. Add a new element to, or delete one of the default elements from, the TMap.
    2. Modify the default value of one of the default elements of the TMap.
    3. Remove all default elements from the TMap, then add a new element and give it the same key as one of the default elements.

RESULT:
In the first instance above, all default elements are removed from the TMap. In the second instance, every non-modified default element is removed from the TMap. In the third instance, the newly added element is removed from the TMap.

EXPECTED:
In the first two instances, any unmodified default elements remain in the TMap, and in the third instance the new element can be given the name of one of the default elements that was removed.

Have Comments or More Details?

Head over to the existingAnswerHub thread and let us know what's up.

9
Login to Vote

Unresolved
ComponentGameplay - Blueprint
Affects Versions4.14.34.16
CreatedJan 17, 2017
UpdatedDec 6, 2018