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"

[C++] Create custom, editor editable Enum

Hi,

For some reasons, I'm trying a create a new Enum class. I need this class to act exactly like the one when you do Right click-> Blueprint -> Enum. I need to be able to add my enum values from the editor.

I have some programing skills, being a web developer as my day job, but my C++ is rusty and even more my UE4 specific C++.

I've look on the Internet all around and couldn't find any help...

I tried creating a new class that extends UUserDefinedEnum and I excepted it to do at least the same thing as the parent one, but I can't use it at all in the editor.

Any tips to point me in the right direction ?

Thanks.

Product Version: UE 4.8
Tags:
more ▼

asked Jul 09 '15 at 08:26 AM in C++ Programming

avatar image

Growiel
51 2 4 7

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

3 answers: sort voted first

Hi,

Here : https://wiki.unrealengine.com/Enums_For_Both_C%2B%2B_and_BP

This is a tutorial about enum : how to create it in C++, where to create it.

If something is not clear just ask :)

I am not sure to have understand fully what you want to do. What do you want to do exactly ? What is supposed to be the result ?

more ▼

answered Jul 09 '15 at 09:44 AM

avatar image

rXp
311 22 17 39

avatar image Growiel Jul 09 '15 at 10:01 AM

Hi!

I already tried that, but this is just to create an Enum (with the values) in C++ and then use it inside the Blueprint.

What I want is something that has the same behavior as the default Enum:

1) right-click in the content browser, go to blueprint, choose Enum (or my new EnumClass) and name it 2) Double click on it inside the CB and from there add the enum values 3) Use it as a blueprint variable or however i want to.

My goal is to add some custom behavior to my enum later on (i want to attach variables to each enum value and still be able to use the dropdowns in the blueprint, a sort of Enum+Struct mix), but for that I first need to be able to reproduce the exact same behavior as the standard one.

avatar image rXp Jul 09 '15 at 10:10 AM

I see, I never tried that I will try to look into it see if I can find something.

avatar image rXp Jul 09 '15 at 02:41 PM

Hi back, you would need to get the engine code from github and modify it from there. I didn't find a way to extend the enum class and integrate it into the game with the prebuilt engine. With the "build yourself" engine you "simply" could modify the class without extending it.

Good luck

avatar image Growiel Jul 18 '15 at 04:55 PM

Sadly that's what I didn't want to hear...

So i just went with an Enum in C++ and a struct using said Enum in my BP for my level designers. Not as cool at all since I have to add the values to the Enum in code, but it get the jobs done.

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

I am now on the street so I am writing this code by my memory.

  1. create a new actor class in engine.

  2. UENUM(BlueprintType) enum EYourEnum { VE_enum1 UMETA(DisplayName="enum1"), VE_enum2 UMETA(DisplayName="enum2"), VE_Max UMETA(Hidden) }

more ▼

answered Jul 09 '15 at 12:18 PM

avatar image

xXTrollBrosXx
71 12 19 21

avatar image Growiel Jul 09 '15 at 02:28 PM

That would just create an Enum with some values in it. I want the values of my new Enum type to be created inside the editor just like it is for the standard Enum.

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

Hi, I'm sorry for disturbing you since this is an question asked about 4 years ago, maybe you won't need this answer now, but I still want to post my answer here for those who have the same problem just like me. Unreal does support Blueprint editable C++ enums, if you can't edit you enum in blueprint anyway, check if ENUM(BlueprintType) presents and your enum is NOT A CONST variable/parameter when exposed to blueprint(this is what I ever did).

more ▼

answered Jun 06 '19 at 09:30 AM

avatar image

SimplestWay
34 1 3 6

(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