Hi everyone,
I encountered a weird problem.
I want to declare a struct in the same class header file I defined it. But it doesn’t like the way I declared it and says “unrecognized class type” in the error message.
I want to declare this struct that I defined, so that I can access it from Blueprint when I use the node “GetClassDefault”
If I declare this struct as a new variable in BP, GetClassDefault will show my struct in the node, however it doesn’t show this if I just define it in C++.
I think there should be a very easy solution, just that I’m completely ignorant on how struct works in C++.
Thank you so much for the help!
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "SkillMaster.generated.h"
UCLASS()
class RENOVA_API ASkillMaster : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ASkillMaster();
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FSkillData SkillData;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
//Use USTRUCT(BlueprintType) if you would like to include your Struct in Blueprints
USTRUCT(BlueprintType)
struct RENOVA_API FSkillData
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString Name;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString Description;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float CD;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float CastTime;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bInterruptable;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bRequireTarget;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UTexture2D* SkillIcon;
};