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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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':

 UENUM()
 typedef enum {
     FirstStateEnum,
     SecondStateEnum
 } STATE_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:

 UPROPERTY()
 TEnumAsByte<STATE_ENUM> entityType;
Product Version: Not Selected
Tags:
more ▼

asked Jan 30 '15 at 08:38 PM in C++ Programming

avatar image

Heoki
10 6 5 9

avatar image eXi Jan 31 '15 at 06:16 PM

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?

avatar image Heoki Jan 31 '15 at 06:21 PM

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.

avatar image Heoki Jan 31 '15 at 07:05 PM

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.

avatar image eXi Jan 31 '15 at 07:19 PM

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.

avatar image Heoki Jan 31 '15 at 07:20 PM

No problem. Thanks for looking! :)

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

1 answer: sort voted first

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.

more ▼

answered Feb 03 '15 at 04:30 PM

avatar image

Heoki
10 6 5 9

(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