TArray and TMap Struct defaults-button error

Add this code to you project:

USTRUCT(BlueprintType)
struct FSomeStruct
{
    GENERATED_BODY()

    UPROPERTY(EditAnywhere, Category = Test)
    FVector MyVector;

    UPROPERTY(EditAnywhere, Category = Test)
    float MyFloat;

    FSomeStruct()
        : MyVector(1.f)
        , MyFloat(5.f)
    {
    }
};

UCLASS()
class PROJECT_API ASomeActor : public AActor
{
    GENERATED_BODY()
    
public:	
    // Sets default values for this actor's properties
    ASomeActor();

    UPROPERTY(EditAnywhere, Category = Test)
    TArray<FSomeStruct> MyStructArray;

    UPROPERTY(EditAnywhere, Category = Test)
    TMap<uint8, FSomeStruct> MyStructMap;
};  

Create a Blueprint based on SomeActor. There are some inconsistencies when editing the blueprint:

  1. Add an array or map element (in either the blueprint or an instance). You will immediately see the yellow (reset-to-default) button indicating a change, although the element has just been created. It should not be visible unless there is an actual deviance from the default values.
  2. The defaults-button next to the array-index correctly restores the default values, while the buttons next to the struct properties (“MyVector”,“MyFloat”) set the properties to zero. These buttons should also set the properties to the values specified in the C++ constructor.
  3. The defaults-button next to “My Struct Array” deletes all entries. I am not sure whether this is expected behaviour, since there is a “Remove all elements”-button which provides this functionality.
  4. Interestingly, if you add entries in your Blueprint, on your instances all the entries specified in the BP are handled correctly. All additional entries added just on the instances suffer from the aformentioned errors.

All the examples apply to TMap as well.

Hello Queelaga,

I searched around our database for a similar issue because I had remembered seeing this. It seems that this issue has already been reported. You can find the bug report for that here: UE-38569. As that bug report only refers to an array of structs, I’ve left a comment on the report to mention that it also occurs with TMaps.

Thank you!