How to use an enum from a different header in blueprints?

I have a third party library I am creating a plugin for in UE4. The library has a ton of different enums and structs. I don’t have any problems interacting with the structs but all of the enums give an error. I was hoping someone could shed some light on this problem.

I’d also like to expose the enums so that they can be selected via blueprints and I’m not sure what the most efficient way of doing that is. If I create a new enum at the top of the file using the same exact structure I have no problems but if its in another file and I try to include that file and use the enum it doesn’t work.

The enums are defined in the header file like this and give an error Unrecognized type ‘STATE_ENUM’:

typedef enum {

I’ve discovered that I can use the ENUM in my code it has an issue specifically when I define a function or property with UFUNCTION or UPROPERTY that it fails. In this scenario I get ‘StateID: Expected the name of a previously defined enum’.

This works:

TEnumAsByte<STATE_ENUM> entityType;

This fails:

TEnumAsByte<STATE_ENUM> entityType;

So you have an enum in your class and a blueprint as the child class and now you want to have the same enum in another class/blueprint?

No, my problem is that I have an enum already defined as shown above in a separate module (ie. “{projectpath}/Source/ThirdParty/MyModule”) and I want to expose those enums through blueprints. I can define a variable with one of the enum types I have created but as soon as I use UPROPERTY or UFUNCTION I get one of those errors.

It’s starting to look more like it’s due to the fact that it’s in another module. It must be something with the way Unreal exposes values to blueprints. I am wondering if there’s a way around this.

Oh i’m sorry. Your Question had not text when i answered. I guess it was broken for me. I only saw the Question Title. ): I guess i can’t help you with that.

No problem. Thanks for looking! :slight_smile:

So ultimately I ended up moving the ThirdParty lib into the plugin instead of in its own module so that the header file could be seen by UHT which appears to be what the problem was. Now I can expose anything in that header file to blueprints pretty easily assuming the types match up.