Setting a playerstate Enum

Hello,

I’m looking to make a simple replicated ENum for a playerstate. Currently I can’t seem do this now.

What would be a way to declare an enumeration in playerstate?

// TeamData.h
UENUM(BlueprintType, Category = "Teams")
enum ETeam
{
	Team_Spectator	    UMETA(DisplayName = "Spectator"),
	Team_Red	    	    UMETA(DisplayName = " Team"),
	Team_Blue            UMETA(DisplayName = "Blue Team")
};

I want my playerstate to default to Spectator - from here I’m being a little crazy with the coding to on postlogin, this variable is checked if you have a team other then spectator it will run a ‘respawn’ routine for that - other wise bring up a pick team menu to then cast this value to your playerstate.

Hello inph1del,

There shouldn’t be anything wrong with what you posted, unless I’m overlooking something. Are you trying to declare this inside of your class for your playerstate? UENUMs need to be declared on their own as USTRUCTS are created. You would declare it as you would with a struct and then make a variable of that enum’s type in your playerstate class. Doing that should end up with the results you’re looking for.

Ahh ok. Yes originally I was trying to declare it in the class of myplayerstate. But saw that it’s changed which explained the errors I was getting.

i ended up going with a uint16? As I can replicate it in playerstate and convert it to the enum value for processing.

Overall I wanted to use some c++ and then blueprint out gameplay.

Learning process, :slight_smile: