UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FGameplayTagQuery Struct Reference

#include <GameplayTagContainer.h>

Public Member Functions

 GENERATED_BODY ()
 
GAMEPLAYTAGS_API FGameplayTagQuery ()
 
GAMEPLAYTAGS_API FGameplayTagQuery (FGameplayTagQuery const &Other)
 
GAMEPLAYTAGS_API FGameplayTagQuery (FGameplayTagQuery &&Other)
 
GAMEPLAYTAGS_API FGameplayTagQueryoperator= (FGameplayTagQuery const &Other)
 
GAMEPLAYTAGS_API FGameplayTagQueryoperator= (FGameplayTagQuery &&Other)
 
GAMEPLAYTAGS_API bool operator== (const FGameplayTagQuery &Other) const
 
GAMEPLAYTAGS_API bool operator!= (const FGameplayTagQuery &Other) const
 
void ReplaceTagsFast (FGameplayTagContainer const &Tags)
 
void ReplaceTagFast (FGameplayTag const &Tag)
 
GAMEPLAYTAGS_API bool Matches (FGameplayTagContainer const &Tags) const
 
GAMEPLAYTAGS_API bool IsEmpty () const
 
GAMEPLAYTAGS_API void Clear ()
 
GAMEPLAYTAGS_API void Build (struct FGameplayTagQueryExpression &RootQueryExpr, FString InUserDescription=FString())
 
GAMEPLAYTAGS_API void GetQueryExpr (struct FGameplayTagQueryExpression &OutExpr) const
 
GAMEPLAYTAGS_API void Serialize (FArchive &Ar)
 
void SetUserDescription (const FString &InUserDescription)
 
const FString & GetDescription () const
 
void GetGameplayTagArray (TArray< FGameplayTag > &OutGameplayTags) const
 
GAMEPLAYTAGS_API const TArray< FGameplayTag > & GetGameplayTagArray () const
 

Static Public Member Functions

static GAMEPLAYTAGS_API FGameplayTagQuery BuildQuery (struct FGameplayTagQueryExpression &RootQueryExpr, FString InDescription=FString())
 
static GAMEPLAYTAGS_API FGameplayTagQuery MakeQuery_MatchAnyTags (FGameplayTagContainer const &InTags)
 
static GAMEPLAYTAGS_API FGameplayTagQuery MakeQuery_MatchAllTags (FGameplayTagContainer const &InTags)
 
static GAMEPLAYTAGS_API FGameplayTagQuery MakeQuery_MatchNoTags (FGameplayTagContainer const &InTags)
 
static GAMEPLAYTAGS_API FGameplayTagQuery MakeQuery_ExactMatchAnyTags (FGameplayTagContainer const &InTags)
 
static GAMEPLAYTAGS_API FGameplayTagQuery MakeQuery_ExactMatchAllTags (FGameplayTagContainer const &InTags)
 
static GAMEPLAYTAGS_API FGameplayTagQuery MakeQuery_MatchTag (FGameplayTag const &InTag)
 

Static Public Attributes

static GAMEPLAYTAGS_API const FGameplayTagQuery EmptyQuery
 

Friends

class FQueryEvaluator
 

Detailed Description

An FGameplayTagQuery is a logical query that can be run against an FGameplayTagContainer. A query that succeeds is said to "match". Queries are logical expressions that can test the intersection properties of another tag container (all, any, or none), or the matching state of a set of sub-expressions (all, any, or none). This allows queries to be arbitrarily recursive and very expressive. For instance, if you wanted to test if a given tag container contained tags ((A && B) || (C)) && (!D), you would construct your query in the form ALL( ANY( ALL(A,B), ALL(C) ), NONE(D) )

You can expose the query structs to Blueprints and edit them with a custom editor, or you can construct them natively in code.

Example of how to build a query via code: FGameplayTagQuery Q; Q.BuildQuery( FGameplayTagQueryExpression() .AllTagsMatch() .AddTag(FGameplayTag::RequestGameplayTag(FName(TEXT("Animal.Mammal.Dog.Corgi")))) .AddTag(FGameplayTag::RequestGameplayTag(FName(TEXT("Plant.Tree.Spruce")))) );

Queries are internally represented as a byte stream that is memory-efficient and can be evaluated quickly at runtime. Note: these have an extensive details and graph pin customization for editing, so there is no need to expose the internals to Blueprints.

Constructor & Destructor Documentation

◆ FGameplayTagQuery() [1/3]

FGameplayTagQuery::FGameplayTagQuery ( )

◆ FGameplayTagQuery() [2/3]

FGameplayTagQuery::FGameplayTagQuery ( FGameplayTagQuery const &  Other)

◆ FGameplayTagQuery() [3/3]

FGameplayTagQuery::FGameplayTagQuery ( FGameplayTagQuery &&  Other)

Member Function Documentation

◆ Build()

void FGameplayTagQuery::Build ( struct FGameplayTagQueryExpression RootQueryExpr,
FString  InUserDescription = FString() 
)

Creates this query with the given root expression.

◆ BuildQuery()

FGameplayTagQuery FGameplayTagQuery::BuildQuery ( struct FGameplayTagQueryExpression RootQueryExpr,
FString  InDescription = FString() 
)
static

Static function to assemble and return a query.

◆ Clear()

void FGameplayTagQuery::Clear ( )

Resets this query to its default empty state.

◆ GENERATED_BODY()

FGameplayTagQuery::GENERATED_BODY ( )

◆ GetDescription()

const FString & FGameplayTagQuery::GetDescription ( ) const
inline

Returns description string.

◆ GetGameplayTagArray() [1/2]

const TArray< FGameplayTag > & FGameplayTagQuery::GetGameplayTagArray ( ) const

Gets the explicit list of all unique gameplay tags referenced by the query.

◆ GetGameplayTagArray() [2/2]

void FGameplayTagQuery::GetGameplayTagArray ( TArray< FGameplayTag > &  OutGameplayTags) const
inline

Gets the explicit list of all unique gameplay tags referenced by the query.

◆ GetQueryExpr()

void FGameplayTagQuery::GetQueryExpr ( struct FGameplayTagQueryExpression OutExpr) const

Builds a FGameplayTagQueryExpression from this query.

◆ IsEmpty()

bool FGameplayTagQuery::IsEmpty ( ) const

Returns true if this query is empty, false otherwise.

◆ MakeQuery_ExactMatchAllTags()

FGameplayTagQuery FGameplayTagQuery::MakeQuery_ExactMatchAllTags ( FGameplayTagContainer const &  InTags)
static

◆ MakeQuery_ExactMatchAnyTags()

FGameplayTagQuery FGameplayTagQuery::MakeQuery_ExactMatchAnyTags ( FGameplayTagContainer const &  InTags)
static

◆ MakeQuery_MatchAllTags()

FGameplayTagQuery FGameplayTagQuery::MakeQuery_MatchAllTags ( FGameplayTagContainer const &  InTags)
static

◆ MakeQuery_MatchAnyTags()

FGameplayTagQuery FGameplayTagQuery::MakeQuery_MatchAnyTags ( FGameplayTagContainer const &  InTags)
static

Shortcuts for easily creating common query types Creates a tag query that will match if there are any common tags between the given tags and the tags being queries against.

◆ MakeQuery_MatchNoTags()

FGameplayTagQuery FGameplayTagQuery::MakeQuery_MatchNoTags ( FGameplayTagContainer const &  InTags)
static

◆ MakeQuery_MatchTag()

FGameplayTagQuery FGameplayTagQuery::MakeQuery_MatchTag ( FGameplayTag const &  InTag)
static

◆ Matches()

bool FGameplayTagQuery::Matches ( FGameplayTagContainer const &  Tags) const

Returns true if the given tags match this query, or false otherwise.

◆ operator!=()

bool FGameplayTagQuery::operator!= ( const FGameplayTagQuery Other) const

◆ operator=() [1/2]

FGameplayTagQuery & FGameplayTagQuery::operator= ( FGameplayTagQuery &&  Other)

◆ operator=() [2/2]

FGameplayTagQuery & FGameplayTagQuery::operator= ( FGameplayTagQuery const &  Other)

Assignment/Equality operators

◆ operator==()

bool FGameplayTagQuery::operator== ( const FGameplayTagQuery Other) const

◆ ReplaceTagFast()

void FGameplayTagQuery::ReplaceTagFast ( FGameplayTag const &  Tag)
inline

Replaces existing tags with passed in tag. Does not modify the tag query expression logic. Useful when you need to cache off and update often used query.

◆ ReplaceTagsFast()

void FGameplayTagQuery::ReplaceTagsFast ( FGameplayTagContainer const &  Tags)
inline

Replaces existing tags with passed in tags. Does not modify the tag query expression logic. Useful when you need to cache off and update often used query. Must use same sized tag container!

◆ Serialize()

void FGameplayTagQuery::Serialize ( FArchive Ar)

Serialize the tag query

◆ SetUserDescription()

void FGameplayTagQuery::SetUserDescription ( const FString &  InUserDescription)
inline

Sets the user-specified description of this query.

Friends And Related Symbol Documentation

◆ FQueryEvaluator

friend class FQueryEvaluator
friend

Member Data Documentation

◆ EmptyQuery

const FGameplayTagQuery FGameplayTagQuery::EmptyQuery
static

The documentation for this struct was generated from the following files: