I have a BP enum:

And I want to create a C++ function that adds a BP node that returns this enum. Something like that:

How can I achieve this?
P.S. My C++ function now:
UFUNCTION(BlueprintCallable, Category = "Tiny Dungeon")
static int ChooseBestDirection(int leftWeight, int rightWeight, int topWeight, int bottomWeight)
{
return 0;
{
I do not believe you can refer to non-C++ enums in C++.
What you can do is convert your int return value to a byte (ToByte(Integer) in blueprint). You can then drag this byte value into your enum node and it will convert the byte to your enum type.
As a quick fix that will do but I would rather just make the Enum in C++ and expose it to Blueprint. The entire point of Enumerations is that you reference it by name and avoid magic number errors.
Looks like it is a best solution. Thank you.