FGameplayTagQuery

An [FGameplayTagQuery](API\Runtime\GameplayTags\FGameplayTagQuery) is a logical query that can be run against an [FGameplayTagContainer](API\Runtime\GameplayTags\FGameplayTagContainer).

Windows
MacOS
Linux

References

Module

GameplayTags

Header

/Engine/Source/Runtime/GameplayTags/Classes/GameplayTagContainer.h

Include

#include "GameplayTagContainer.h"

Syntax

struct FGameplayTagQuery

Remarks

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))) .AddTag(FGameplayTag::RequestGameplayTag))) );

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.

Constructors

Name Description

Public function

FGameplayTagQuery()

Public function

FGameplayTagQuery

(
    FGameplayTagQuery const& Other
)

Public function

FGameplayTagQuery

(
    FGameplayTagQuery&& Other
)

Functions

Name Description

Public function

void

 

Build

(
    FGameplayTagQueryExpression& RootQ...,
    FString InUserDescription
)

Creates this query with the given root expression.

Public function

void

 

BuildFromEditableQuery

(
    UEditableGameplayTagQuery& Editabl...
)

Creates this query based on the given EditableQuery object

Public function Static

FGameplayTag...

 

BuildQuery

(
    FGameplayTagQueryExpression& RootQ...,
    FString InDescription
)

Static function to assemble and return a query.

Public function

void

 

Clear()

Resets this query to its default empty state.

Public function

UEditableGam...

 

CreateEditableQuery()

Creates editable query object tree based on this query

Public function Const

const FStrin...

 

GetDescription()

Returns description string.

Public function Const

void

 

GetQueryExpr

(
    FGameplayTagQueryExpression& OutEx...
)

Builds a FGameplayTagQueryExpression from this query.

Public function Const

bool

 

IsEmpty()

Returns true if this query is empty, false otherwise.

Public function Static

FGameplayTag...

 

MakeQuery_MatchAllTags

(
    FGameplayTagContainer const& InTag...
)

Public function Static

FGameplayTag...

 

MakeQuery_MatchAnyTags

(
    FGameplayTagContainer const& InTag...
)

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.

Public function Static

FGameplayTag...

 

MakeQuery_MatchNoTags

(
    FGameplayTagContainer const& InTag...
)

Public function Static

FGameplayTag...

 

MakeQuery_MatchTag

(
    FGameplayTag const& InTag
)

Public function Const

bool

 

Matches

(
    FGameplayTagContainer const& Tags
)

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

Public function

void

 

ReplaceTagFast

(
    FGameplayTag const& Tag
)

Replaces existing tags with passed in tag.

Public function

void

 

ReplaceTagsFast

(
    FGameplayTagContainer const& Tags
)

Replaces existing tags with passed in tags.

Operators

Name Description

Public function

FGameplayTag...

 

operator=

(
    FGameplayTagQuery const& Other
)

Assignment/Equality operators

Public function

FGameplayTag...

 

operator=

(
    FGameplayTagQuery&& Other
)

Constants

Name

Description

EmptyQuery

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss