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"

Enumertation differences in bp and c++

Hello when creating a BP Enum there are differences in what variable names are allowed compared to a C++ Enum, in my case I want to have the variable names inside the enum be 1, 2, 3, 4, 5 and that's fine for a BP Enum but when trying to do it in a C++ Enum I just get an error. The error is presumably because it isn't allowed but how does the engine parse it and make it work then? What could be my workarounds?

The Enum has numeric names because it is used for handling speed and I know that I could just switch on int but with the Enum I can easily see which values should be allowed and it becomes a lot easier to upkeep.

Product Version: Not Selected
more ▼

asked Oct 22 '18 at 02:48 PM in C++ Programming

avatar image

23 3 3 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

In pure C++, an enum will have a backing int value like so

 enum MyEnum {
     Open = 0,
     Closed = 1,
     Locked = 100,

With UE4 UEnums, the engine uses metadata to add more details to an enum value (so you can see user friendly names in the editor). This is done like this:

 enum class EDoorState : uint8 {
     Open            UMETA(DisplayName = "Door Open"),
     Closed            UMETA(DisplayName = "Door Closed"),
     Locked    = 100    UMETA(DisplayName = "Door Locked")

You can grab these values from the UEnum class. Have a look at this wiki for more info

If you want valid numbers for constraint checking with integer values, try using a TSet instead. It would be much faster

more ▼

answered Oct 22 '18 at 03:18 PM

avatar image

Ali Akbar
691 2 6 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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