Hello, I have a question here about the enum class in UE4 , now is the I have more than 255 values to set in a enum class like :
ENUM(BlueprintType)
enum class ECityMapMeshTag : uint8
{
RoadTwoLanes_LaneLeft UMETA(DisplayName = "Road: Two Lanes - Lane Left"),
RoadTwoLanes_LaneRight UMETA(DisplayName = "Road: Two Lanes - Lane Right"),
RoadTwoLanes_SidewalkLeft UMETA(DisplayName = "Road: Two Lanes - Sidewalk Left"),
RoadTwoLanes_SidewalkRight UMETA(DisplayName = "Road: Two Lanes - Sidewalk Right"),
RoadTwoLanes_LaneMarkingSolid UMETA(DisplayName = "Road: Two Lanes - Lane Marking Solid"),
RoadTwoLanes_LaneMarkingBroken UMETA(DisplayName = "Road: Two Lanes - Lane Marking Broken"),
...
...
...
\\\more than 255 Tags.
NUMBER_OF_TAGS UMETA(Hidden),
INVALID UMETA(Hidden)
};
But type enums support uint8 only, can I use uint32 instead of uint8? if not , how can I do to make the maximal value more than 255??
Ali_Akbar
(Ali_Akbar)
October 3, 2018, 3:20am
2
It works without blueprint support, but if you want to expose this to blueprints, you’ll have to stick with uint8
UENUM()
enum class ECityMapMeshTag : uint16
{
RoadTwoLanes_LaneLeft UMETA(DisplayName = "Road: Two Lanes - Lane Left")
};
The above code compiles just fine if I remove BlueprintType from UENUM
the other way around would be to rethink your enums. You might want to shrunk down such a massive enum into smaller pieces that would be more relevant. For instance separate things in two at first with sidewalks in an enum and main road in an other, and so on.
1 Like
MRSagor949
(MRSagor949)
January 25, 2021, 8:48pm
5
Hey, When I try to create enum with class . I got a lots of erros in my visual studio . Now how can i fix it.
#pragma once
#include “CoreMinimal.h”
#include “MRSEnumLibrary.generated.h”
UENUM(BlueprintType)
enum class EGait : uint8
{
Walking,
Running,
Sprinting,
};
I don’t know what is the prlm.
MRSagor949
(MRSagor949)
January 26, 2021, 9:40pm
6
I could not create any types of enum in my header file with a none c++ class.
Comma only for separating the elements, the last one is not necessary