Hello,
I am experiencing large difficulties when trying to make myself an enumeration using c++. I’ve made an empty class called TeamsEnum which will store a list of available teams, and I actually think I’ve managed to make it work. Although, I am trying to use this enum in my character class, called CharacterBase. For now, my problem is that I can’t seem to make a simple variable of this enum type. When compiling, I’m getting errors saying:
“Unrecognized type ‘TeamsEnum’ - type must be a UCLASS, USTRUCT or UENUM”
In the .h of TeamsEnum I’ve made an enum like this and it returns me no errors:
UENUM(BlueprintType)
enum class ETeamsEnum : uint8
{
ETeam_Blue UMETA(DisplayName = "Blue"),
ETeam_Red UMETA(DisplayName = "Red"),
ETeam_Wilderness UMETA(DisplayName = "Wilderness")
};
The .cpp file of TeamsEnum is untouched.
In my CharacterBase.h I’ve tried to make a variable of this enum:
UPROPERTY(EditAnywhere, Category = "Player")
TeamsEnum* Team;
I’m not sure why it doesn’t work, but I assume it has something to do with the prefix. For example, if I would make a variable of an actor, I would do “ASampleActor* SampleActor;”. But how do I do this if it’s not an actor, and simply an empty class? Do I use “UTeamsEnum* Team;” or simply just “TeamsEnum* Team;” like I’ve already done?
I also forward-declared the class further up in the file, where I’ve delcared all my other classes like UCameraComponent and USpringArmComponent:
class UCameraComponent;
class USpringArmComponent;
class TeamsEnum;
I seriously have no idea what I’m missing or doing wrong, so any help would be appreciated. Please don’t link any other threads refering to similar issues, as I’ve probably already read all of them and still don’t understand how to do this.
Thanks in advance!
~Stefan