C++ Array of struct initialized values reset by blueprint child class

Hello,

So this issue has been baffling me for a little while now and I can’t seem to figure out what is happening.

In essence, I have a c++ player state class which uses an array of ustruct as a container. I initialize the array with default values in the .h file. Then, I have a blueprint that is a child of the playerstate and I have the playerstate read off the value of everything in the array. What happens is that the array seems to have changed its values so uninitialized defaults (i.e. int is 0, enums take the first enum types ect).

UENUM(BlueprintType)
enum class ESaveTypeEnum : uint8
{
	VE_FortSave UMETA(DisplayName = "Fortitude"),
	VE_RefSave UMETA(DisplayName = "Reflex"),
	VE_WillSave UMETA(DisplayName = "Will")
};
  • USTRUCT(BlueprintType)
    struct FCharacterSaves
    {
    GENERATED_USTRUCT_BODY()
    public:
    UPROPERTY(BlueprintReadOnly, Category = “Saves”)
    ESaveTypeEnum SaveName;

      UPROPERTY(BlueprintReadOnly, Category = "Saves")
      	int SaveBonus;
    
      UPROPERTY(BlueprintReadOnly, Category = "Saves")
      	EAttributesEnum RelatedAttribute;
    

    };

  • UCLASS()
    class TOPDOWN_API AMyPlayerState : public APlayerState
    {
    GENERATED_BODY()

    public:
    AMyPlayerState(const FObjectInitializer& ObjectInitializer);

      virtual void BeginPlay() override;
      .	
      .
     .
    

    protected:
    .
    .
    .
    UPROPERTY( BlueprintReadOnly, Category = “Saves”)
    TArray MyCharacterBaseSaves =
    {{ESaveTypeEnum::VE_FortSave, 20, EAttributesEnum::VE_CON},
    {ESaveTypeEnum::VE_RefSave, 20, EAttributesEnum::VE_DEX},
    {ESaveTypeEnum::VE_WillSave, 20, EAttributesEnum::VE_WIS} };

    UPROPERTY( BlueprintReadOnly, Category = “Saves”)
    TArray MyCharacterSaves =
    {{ESaveTypeEnum::VE_FortSave, 20, EAttributesEnum::VE_CON},
    {ESaveTypeEnum::VE_RefSave, 20, EAttributesEnum::VE_DEX},
    {ESaveTypeEnum::VE_WillSave, 20, EAttributesEnum::VE_WIS} };

What happens is that my blueprint playerstate changes the values to fort, 0, strength for every element.

I don’t have this issue with any other struct arrays or class arrays or variables from this c++ class to blueprint

I would like to add that changing the entire thing to its own class and then initializing an array of that class works. But I would like to understand why the array of structs doesnt.