# C++ function with UENUM input shows it as "unsupported" in BP

**URL:** <https://forums.unrealengine.com/t/c-function-with-uenum-input-shows-it-as-unsupported-in-bp/1517165>\
**Category:** Programming & Scripting\
**Tags:** enumeration, UEnum, ENUM, unreal-engine, CPP, Blueprint, question\
**Created:** [December 11, 2023, 3:08pm UTC](https://forums.unrealengine.com/t/c-function-with-uenum-input-shows-it-as-unsupported-in-bp/1517165 "2023-12-11T15:08:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MisterPixel](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/misterpixel/32/629747_2.png) [@MisterPixel](https://forums.unrealengine.com/u/MisterPixel)\
**Post date:** [December 11, 2023, 3:08pm UTC](https://forums.unrealengine.com/t/c-function-with-uenum-input-shows-it-as-unsupported-in-bp/1517165/1 "2023-12-11T15:08:00Z")

</div>

Hello!

So, I’ve created a very simple UENUM in my custom Actor’s .h header file, which looks like this:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/c/e/1ce006b1f7f8a0a03c289356866f009e75ce8d4f.png)

Please have in mind that this UENUM declaration is **outside** my custom Actor’s UCLASS declaration, but in the same .h header file (just **above** the UCLASS declaration).

Then, inside the UCLASS, I have a UFUNCTION being declared, and also defined in the .cpp file, as follows:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/b/93b2fd7fec03db910d84ec2fc2c6448fbaf262c2.png)

As you can see, the function takes one such UENUM as input. All works fine inside C++, I can use it in all sorts of code, however when trying to expose it to BP, the following happens:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/b/3bb6c9a11a110de89ab50ca70bb25c31f28194eb.png)

What you’ll notice is that BP has _no problem_ identifying my UENUM, as it can _correctly_ create a **Literal** of it, with all of the fields displayed _correctly_. However, the _problem_ is with my **Function** that takes such an UENUM as **input** , since for some reason, it _fails_ to properly detect the **input** , giving out the following _error_ (you can also see it in the above screenshot):

> unsupported\_enum\_type: enum size is larger than a byte

Any idea as to what I might be doing wrong?  
Thank you so much!

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [December 11, 2023, 3:17pm UTC](https://forums.unrealengine.com/t/c-function-with-uenum-input-shows-it-as-unsupported-in-bp/1517165/2 "2023-12-11T15:17:44Z")

</div>

You haven’t specified the type to use for the enum. The definition should look like this:

`enum class EDifficultyLevels : uint8`

---

<div class="post-metadata">

**Author:** ![MisterPixel](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/misterpixel/32/629747_2.png) [@MisterPixel](https://forums.unrealengine.com/u/MisterPixel)\
**Post date:** [December 11, 2023, 3:34pm UTC](https://forums.unrealengine.com/t/c-function-with-uenum-input-shows-it-as-unsupported-in-bp/1517165/3 "2023-12-11T15:34:43Z")

</div>

Thank you so much!!! 😍 You’re absolutely right indeed, I never knew that was actually a thing in UE to be honest…

Plus, after further discussions on Discord, it now became apparent to me that UENUMS must “inherit” from the primitive type **uint8** , so that their size is exactly 1 Byte, in order for them to be able to be properly exposed to Blueprint.

Btw, UENUMs **only** support up to 32 values (ranged 0 -31), so not even the full 256 spectrum (0 - 255) of 1 Byte!!! Since regular C++ has no such restrictions, this was totally unbeknownst to me, but now it all makes sense. So, for UENUMS always do a:

> enum class EMyEnum : uint8

if you wish to expose your UENUM to BP! Otherwise, for regular C++ cases and regular **enums** , it’s not mandatory. 💪

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 10, 2024, 3:35pm UTC](https://forums.unrealengine.com/t/c-function-with-uenum-input-shows-it-as-unsupported-in-bp/1517165/4 "2024-01-10T15:35:13Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
