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:
- 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.
- 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.
- 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.
- 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.