Custom Blueprint Node with Enum

Hi I want to program a custom blueprint Node in c++ that has an Enum as input and a String as output.

So what I want to achieve is a list of predefined UUID strings to select from. :slight_smile:

So if made a custom EnumClass like follows:

UENUM(BlueprintType)		
enum class MyCustomEnum : uint8
{
    MCE_String1   UMETA(DisplayName="String1"),
    MCE_String2   UMETA(DisplayName="String2"),
	MCE_String3   UMETA(DisplayName="String3")
};

but how do I set up my pure blueprint node to use this enum as an Input and to output “String1”, “String2” or “String3” according to the choice?

Thanks!

Hi Appsite Gmbh,

I set this up in my Character class. You can choose to do the same or use another but if you do choose to use another class, it’s up to you to get the reference to it in Blueprint so you can access the function.

[.h]

UENUM(Blueprintable)
enum class EMyEnumClass : uint8
{
	OPTION_ONE		UMETA(DisplayName = "String1"),
	OPTION_TWO		UMETA(DisplayName = "String2"),
	OPTION_THREE	UMETA(DisplayName = "String3"),
};

UCLASS(config=Game)
class AFPSCPPCharacter : public ACharacter
{
	GENERATED_BODY()

public:
	AFPSCPPCharacter();

	UFUNCTION(BlueprintCallable, Category = "Character")
	FString MyEnumTestFunction(EMyEnumClass In);
}

[.cpp]

FString AFPSCPPCharacter::MyEnumTestFunction( EMyEnumClass In )
{
	switch (In)
	{
	case EMyEnumClass::OPTION_ONE:
		return "String One";
	case EMyEnumClass::OPTION_TWO:
		return "String Two";
	case EMyEnumClass::OPTION_THREE:
		return "String Three";
	default:
		return "None";
	}
}

This results in the Blueprint node:

98220-451116_bp.png

That worked like a charme. Thank you!