20 Aug 2022
By ubyte.dev
Topic: Unreal Engine 5 C++
Whenever you’re exposing Gameplay Tags to the blueprint surface, the engine allows you to filter which Gameplay Tags are selectable.
The rest is hidden
This is achieved with specific UFUNCTION and/or UPROPERTY metadata specifiers.
UPROPERTY(EditAnywhere, Meta = (Category = "Foo.Bar")) FGameplayTag GameplayTag;
UPROPERTY-level filtering:
UFUNCTION(BlueprintCallable, Meta = (GameplayTagFilter = "Foo.Bar")) void Something(FGameplayTag GameplayTag);
UFUNCTION-level filtering:
UFUNCTION(BlueprintCallable) void Something(UPARAM(Meta = (Category = "Foo.Bar")) FGameplayTag GameplayTag);
UFUNCTION individual arguments:
You can also decide to filter tags based on Category instead of root tag.
UPROPERTY(EditAnywhere, Meta = (Category = "MyCategory")) FGameplayTag GameplayTag;
UPROPERTY-level filtering:
UFUNCTION(BlueprintCallable, Meta = (GameplayTagFilter = "MyCategory") void Something(FGameplayTag GameplayTag);
UFUNCTION-level filtering:
UFUNCTION(BlueprintCallable) void Something(UPARAM(Meta = (Category = "MyCategory")) FGameplayTag GameplayTag);
UFUNCTION individual arguments:
Here’s how that would look inside Project Settings.
GameplayTags inside Project Settings
Filtering based on Category comes with more advantages, as it allows you to map multiple tags to one filter string.
GameplayTags inside Project Settings
This allows you to further extend the Category in the editor, without modifying the C++ codebase.
Third-party code (plugins) can greatly benefit from these features.