x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UENUM enum class with uint8

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??

Product Version: UE 4.18
Tags:
more ▼

asked Oct 02 '18 at 06:41 PM in C++ Programming

avatar image

JohnnsQuandt
7 1 1 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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

more ▼

answered Oct 03 '18 at 03:20 AM

avatar image

Ali Akbar
671 1 5 7

avatar image JohnnsQuandt Oct 05 '18 at 04:55 PM

Thanks, that helps.

avatar image TheDreamCatcher Oct 06 '18 at 05:19 AM

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.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question