[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.

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.

Hi,

Here : A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

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

If something is not clear just ask :slight_smile:

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 ?

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

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)
  }

`

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.

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

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.

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).

1 Like