# UENUM Default Value

**URL:** <https://forums.unrealengine.com/t/uenum-default-value/361622>\
**Category:** Blueprint\
**Tags:** ENUM, unreal-engine, CPP, Blueprint, question\
**Created:** [June 21, 2016, 9:36pm UTC](https://forums.unrealengine.com/t/uenum-default-value/361622 "2016-06-21T21:36:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thebluefish](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Thebluefish](https://forums.unrealengine.com/u/Thebluefish)\
**Post date:** [June 21, 2016, 9:36pm UTC](https://forums.unrealengine.com/t/uenum-default-value/361622/1 "2016-06-21T21:36:07Z")

</div>

Say I wanted to create an enum in C++, simple enough:

```
enum MyTestEnum
{
    MTE_Test_1 = (1 << 0),
    MTE_Test_2 = (1 << 1),

    MTE_LAST = (1 << 31)
};

```

Now I want to expose this to Blueprints, so I change it a bit by following [this tutorial](https://wiki.unrealengine.com/Enums_For_Both_C%2B%2B_and_BP):

```
UENUM(BlueprintType)
enum class MyTestEnum : uint8
{
    MTE_Test_1 = (1 << 0) UMETA(DisplayName="Test 1"),
    MTE_Test_2 = (1 << 1) UMETA(DisplayName="Test 2"),

    MTE_LAST = (1 << 31) UMETA(Hidden)
};

```

This doesn’t compile. However removing the values from the enum compiles just fine. How can I assign a value to each entry in the enum?

---

<div class="post-metadata">

**Author:** ![Steve\_Robb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Steve\_Robb](https://forums.unrealengine.com/u/Steve_Robb)\
**Post date:** [June 22, 2016, 9:42am UTC](https://forums.unrealengine.com/t/uenum-default-value/361622/2 "2016-06-22T09:42:36Z")

</div>

Hi,

UnrealHeaderTool does not parse general enum value expressions. You should expand those out yourself:

```
UENUM(BlueprintType)
enum class MyTestEnum : uint8
{
    MTE_Test_1 = 0x00000001 UMETA(DisplayName="Test 1"),
    MTE_Test_2 = 0x00000002 UMETA(DisplayName="Test 2"),

    MTE_LAST = 0x80000000 UMETA(Hidden)
};

```

Hope this helps,

Steve

---

<div class="post-metadata">

**Author:** ![marsonmao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@marsonmao](https://forums.unrealengine.com/u/marsonmao)\
**Post date:** [December 15, 2016, 3:18am UTC](https://forums.unrealengine.com/t/uenum-default-value/361622/3 "2016-12-15T03:18:31Z")

</div>

An enum of `uint8` can not hold `(1 << 31)`, right?

---

<div class="post-metadata">

**Author:** ![DarthPJB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DarthPJB](https://forums.unrealengine.com/u/DarthPJB)\
**Post date:** [June 26, 2018, 11:35am UTC](https://forums.unrealengine.com/t/uenum-default-value/361622/4 "2018-06-26T11:35:39Z")

</div>

Absolutely right, yes.
