cant set values on custom struct in blueprint editor, still can set them in blueprint.

I am trying to use a custom c++ struct in a ActorComponent. I can access the struct from the component in Blueprint and break it to edit the values on the struct, create a new one in the blueprint view and so on. But if i try to add my struct as a Variable in blueprintview or inspect it in the detailspannel, i cant see or edit its values.


Code: statics.h


 
 USTRUCT(Blueprintable) struct FStatics {     GENERATED_BODY()          UPROPERTY(BlueprintReadWrite, Category = "Statics")     EStaticsTypes Type;          UPROPERTY(BlueprintReadWrite, Category = "Statics")     float minVal;          UPROPERTY(BlueprintReadWrite, Category = "Statics")     float maxVal;          UPROPERTY(BlueprintReadWrite, Category = "Statics")     float currentVal;      FStatics():Type(EStaticsTypes::Dexterity),minVal(0),maxVal(0),currentVal(0) {}; }; 

Code: StatComponent.h


 
 UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) class BUFFS_API UStatComponent : public UActorComponent {     GENERATED_BODY() public:         UStatComponent();  protected:     virtual void BeginPlay() override; private:     void PopulateStats(); public:         virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;      UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Stats)     FStatics Stats; }; 

Code: StatComponent.cpp


 
 UStatComponent::UStatComponent() {     PrimaryComponentTick.bCanEverTick = true;     FStatics statics;     statics.Type = EStaticsTypes::Health;     statics.currentVal = 0.0f;     statics.minVal = 0.0f;     statics.maxVal = 0.0f;     Stats = statics; }   



USTRUCT(BlueprintType)
struct FStatics { 
    GENERATED_BODY()
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Statics")
        EStaticsTypes Type;        
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Statics")
        float minVal;      
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Statics")
        float maxVal;        
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Statics")
        float currentVal;    
    FStatics():Type(EStaticsTypes::Dexterity), minVal(0), maxVal(0), currentVal(0) {}; 
};


2 Likes

thanks, that fixed it.