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"

Default value for Enum parameter of a BP function

I created a BP function with an Enum parameter.

The Enum is, for example:

Enum MyEnum { First, Second }

(I wrote it in C++, but it is actually in Blueprint).

I want to set a default value for that parameter. When I open the details tab of the function, I would expect to have a dropdown list for the Enum parameter that let me choose the default value. Instead there is still a generic text box in which I have to write something. If I write the string value of MyEnum, like "Second", it doesn't work. If I write "NewEnumerator1" it works! It basically wants the name of the entry that is automatically generated when you create new entries for the Enum in the editor.

Is this the right behaviour? As I said, I'd prefer to select the value from a dropdown list with all the entries of my Enum type.

Thank you

Product Version: UE 4.9
Tags:
more ▼

asked Oct 16 '15 at 10:23 AM in Blueprint Scripting

avatar image

RiccardoClimax
6 1 2 1

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

I copy "Make Literal Enum" node to text editor and figured it out

NewEnumerator0

NewEnumerator1

NewEnumerator2

0 is first element in enum

NewEnumerator + Index

more ▼

answered Nov 26 '16 at 08:58 AM

avatar image

Smomo
174 13 17 32

avatar image Smomo Nov 26 '16 at 09:00 AM

But I think it is a pain to set the parameter if it has no dropdown list

(comments are locked)
10|2000 characters needed characters left

It should work automatically if your enum is a UEnum, is it?

more ▼

answered Oct 16 '15 at 11:33 AM

avatar image

G4m4
690 27 15 33

(comments are locked)
10|2000 characters needed characters left

It doesn't for me. Creating the Enum in Blueprint or in C++ (as UEnum) gets me the same behaviour, it shows just a text box in the editor.

more ▼

answered Oct 16 '15 at 11:47 AM

avatar image

RiccardoClimax
6 1 2 1

avatar image G4m4 Oct 16 '15 at 12:18 PM

If you really want to understand what's happening there, you could try debugging it using the Widget reflector (in Window -> developer tools).

Could you copy and paste the code of your BP function declaration?

avatar image RiccardoClimax Oct 16 '15 at 01:44 PM

Thank you for your replies.

With the Widget reflector I can clearly see that it is creating an SEditableTextBox rather than an STextBlock.

My BP function is defined in the editor, there is no C++ declaration, it's a function of a Blueprint class. Adding an enum parameter to the function I get this.alt text

enumparam1.png (7.3 kB)
avatar image G4m4 Oct 16 '15 at 03:03 PM

How are you declaring your custom enum in C++?

avatar image phil.harlow Jan 07 '16 at 07:20 PM

I just encountered this, and entering the full name of the enum value worked for me. My enum in c++:

 enum EDialogPriority
 {
     DP_Queue            UMETA(DisplayName = "Add to Queue"),
     DP_Immediate        UMETA(DisplayName = "Play immediately"),
     DP_DropIfPlaying    UMETA(DisplayName = "Drop if dialog playing"),
     //
     DP_Max                UMETA(Hidden),
 };

My default value field: DP_Queue

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