FBlackboardKeySelector Adding Enum Filter

Hello!!

I want to add a Enum to my filter for my FBlackboardKeySelector, but I’m not sure on how to add the enum. I have it available globally, but to assign in the AddEnumFilter parameter I’m not sure.

EnemyKey.AddEnumFilter(this, /*HOW TO ADD ENUM*/);

Any help would be great :frowning:

http://puu.sh/pgL2R/6bc29c82ef.png

Anything would be great :frowning:

Hi. I do not experiment with this code. I only found it by search:

UEnum* Enum = FindObjectChecked<UEnum>(ANY_PACKAGE, TEXT("EContentSourceCategory"));
...
if (UEnum* Enum = Cast<UEnum>(InType.PinSubCategoryObject.Get()))
...
UEnum* const DependencyRuleEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("EDependencyConversionRule"))

From Rama’s code:
https://wiki.unrealengine.com/Enums_For_Both_C%2B%2B_and_BP

template <typename EnumType>
static FORCEINLINE EnumType GetEnumValueFromString(const FString& EnumName, const FString& String)
{ 
	UEnum* Enum = FindObject<UEnum>(ANY_PACKAGE, *EnumName, true);
	if(!Enum) 
        { 
          return EnumType(0);
        }		
	return (EnumType)Enum->FindEnumIndex(FName(*String));
}

You can do it like that:

MyKey.AddEnumFilter(
		this,
		GET_MEMBER_NAME_CHECKED(UMyNode, MyKey),
		StaticEnum<EMyEnum>()
		);
3 Likes

You can do it like that:

MyKey.AddEnumFilter(
		this,
		GET_MEMBER_NAME_CHECKED(UMyNode, MyKey),
		StaticEnum<EMyEnum>()
		);

This helps me thank you!

1 Like