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

#include <GameplayTagContainer.h>

+ Inheritance diagram for FGameplayTagContainer:

Public Member Functions

 FGameplayTagContainer ()
 
 FGameplayTagContainer (FGameplayTagContainer const &Other)
 
 FGameplayTagContainer (const FGameplayTag &Tag)
 
 FGameplayTagContainer (FGameplayTagContainer &&Other)
 
 ~FGameplayTagContainer ()
 
GAMEPLAYTAGS_API FGameplayTagContaineroperator= (FGameplayTagContainer const &Other)
 
GAMEPLAYTAGS_API FGameplayTagContaineroperator= (FGameplayTagContainer &&Other)
 
GAMEPLAYTAGS_API bool operator== (FGameplayTagContainer const &Other) const
 
GAMEPLAYTAGS_API bool operator!= (FGameplayTagContainer const &Other) const
 
bool HasTag (const FGameplayTag &TagToCheck) const
 
bool HasTagExact (const FGameplayTag &TagToCheck) const
 
bool HasAny (const FGameplayTagContainer &ContainerToCheck) const
 
bool HasAnyExact (const FGameplayTagContainer &ContainerToCheck) const
 
bool HasAll (const FGameplayTagContainer &ContainerToCheck) const
 
bool HasAllExact (const FGameplayTagContainer &ContainerToCheck) const
 
int32 Num () const
 
bool IsValid () const
 
bool IsEmpty () const
 
GAMEPLAYTAGS_API FGameplayTagContainer GetGameplayTagParents () const
 
GAMEPLAYTAGS_API FGameplayTagContainer Filter (const FGameplayTagContainer &OtherContainer) const
 
GAMEPLAYTAGS_API FGameplayTagContainer FilterExact (const FGameplayTagContainer &OtherContainer) const
 
GAMEPLAYTAGS_API bool MatchesQuery (const struct FGameplayTagQuery &Query) const
 
GAMEPLAYTAGS_API void AppendTags (FGameplayTagContainer const &Other)
 
GAMEPLAYTAGS_API void AppendMatchingTags (FGameplayTagContainer const &OtherA, FGameplayTagContainer const &OtherB)
 
GAMEPLAYTAGS_API void AddTag (const FGameplayTag &TagToAdd)
 
GAMEPLAYTAGS_API void AddTagFast (const FGameplayTag &TagToAdd)
 
GAMEPLAYTAGS_API bool AddLeafTag (const FGameplayTag &TagToAdd)
 
GAMEPLAYTAGS_API bool RemoveTag (const FGameplayTag &TagToRemove, bool bDeferParentTags=false)
 
GAMEPLAYTAGS_API void RemoveTags (const FGameplayTagContainer &TagsToRemove)
 
GAMEPLAYTAGS_API void Reset (int32 Slack=0)
 
GAMEPLAYTAGS_API bool Serialize (FStructuredArchive::FSlot Slot)
 
GAMEPLAYTAGS_API bool NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
 
GAMEPLAYTAGS_API bool ImportTextItem (const TCHAR *&Buffer, int32 PortFlags, UObject *Parent, FOutputDevice *ErrorText)
 
GAMEPLAYTAGS_API void PostScriptConstruct ()
 
GAMEPLAYTAGS_API FString ToString () const
 
GAMEPLAYTAGS_API void FromExportString (const FString &ExportString, int32 PortFlags=0)
 
GAMEPLAYTAGS_API FString ToStringSimple (bool bQuoted=false) const
 
GAMEPLAYTAGS_API TArray< FString > ToStringsMaxLen (int32 MaxLen) const
 
GAMEPLAYTAGS_API FText ToMatchingText (EGameplayContainerMatchType MatchType, bool bInvertCondition) const
 
void GetGameplayTagArray (TArray< FGameplayTag > &InOutGameplayTags) const
 
GAMEPLAYTAGS_API const TArray< FGameplayTag > & GetGameplayTagArray () const
 
TArray< FGameplayTag >::TConstIterator CreateConstIterator () const
 
bool IsValidIndex (int32 Index) const
 
FGameplayTag GetByIndex (int32 Index) const
 
FGameplayTag First () const
 
FGameplayTag Last () const
 
GAMEPLAYTAGS_API void FillParentTags ()
 

Static Public Member Functions

template<class AllocatorType >
static FGameplayTagContainer CreateFromArray (const TArray< FGameplayTag, AllocatorType > &SourceTags)
 

Static Public Attributes

static GAMEPLAYTAGS_API const FGameplayTagContainer EmptyContainer
 

Protected Member Functions

bool RemoveTagByExplicitName (const FName &TagName)
 
GAMEPLAYTAGS_API void AddParentsForTag (const FGameplayTag &Tag)
 

Protected Attributes

TArray< FGameplayTagGameplayTags
 
TArray< FGameplayTagParentTags
 

Friends

class UGameplayTagsManager
 
class FGameplayTagRedirectors
 
struct FGameplayTagQuery
 
struct FGameplayTagQueryExpression
 
struct FGameplayTagNode
 
struct FGameplayTag
 
TArray< FGameplayTag >::TConstIterator begin (const FGameplayTagContainer &Array)
 
TArray< FGameplayTag >::TConstIterator end (const FGameplayTagContainer &Array)
 

Detailed Description

A Tag Container holds a collection of FGameplayTags, tags are included explicitly by adding them, and implicitly from adding child tags

Constructor & Destructor Documentation

◆ FGameplayTagContainer() [1/4]

FGameplayTagContainer::FGameplayTagContainer ( )
inline

Constructors

◆ FGameplayTagContainer() [2/4]

FGameplayTagContainer::FGameplayTagContainer ( FGameplayTagContainer const &  Other)
inline

◆ FGameplayTagContainer() [3/4]

FGameplayTagContainer::FGameplayTagContainer ( const FGameplayTag Tag)
inlineexplicit

Explicit to prevent people from accidentally using the wrong type of operation

◆ FGameplayTagContainer() [4/4]

FGameplayTagContainer::FGameplayTagContainer ( FGameplayTagContainer &&  Other)
inline

◆ ~FGameplayTagContainer()

FGameplayTagContainer::~FGameplayTagContainer ( )
inline

Member Function Documentation

◆ AddLeafTag()

bool FGameplayTagContainer::AddLeafTag ( const FGameplayTag TagToAdd)

Adds a tag to the container and removes any direct parents, wont add if child already exists

Parameters
TagThe tag to try and add to this container
Returns
True if tag was added

◆ AddParentsForTag()

void FGameplayTagContainer::AddParentsForTag ( const FGameplayTag Tag)
protected

◆ AddTag()

void FGameplayTagContainer::AddTag ( const FGameplayTag TagToAdd)

Add the specified tag to the container

Parameters
TagToAddTag to add to the container

◆ AddTagFast()

void FGameplayTagContainer::AddTagFast ( const FGameplayTag TagToAdd)

Add the specified tag to the container without checking for uniqueness

Parameters
TagToAddTag to add to the container

Useful when building container from another data struct (TMap for example)

◆ AppendMatchingTags()

void FGameplayTagContainer::AppendMatchingTags ( FGameplayTagContainer const &  OtherA,
FGameplayTagContainer const &  OtherB 
)

Adds all the tags that match between the two specified containers to this container. WARNING: This matches any parent tag in A, not just exact matches! So while this should be the union of the container this is called on with the intersection of OtherA and OtherB, it's not exactly that. Since OtherB matches against its parents, any tag in OtherA which has a parent match with a parent of OtherB will count. For example, if OtherA has Color.Green and OtherB has Color.Red, that will count as a match due to the Color parent match! If you want an exact match, you need to call A.FilterExact(B) (above) to get the intersection of A with B. If you need the disjunctive union (the union of two sets minus their intersection), use AppendTags to create Union, FilterExact to create Intersection, and then call Union.RemoveTags(Intersection).

Parameters
OtherATagContainer that has the matching tags you want to add to this container, these tags have their parents expanded
OtherBTagContainer used to check for matching tags. If the tag matches on any parent, it counts as a match.

◆ AppendTags()

void FGameplayTagContainer::AppendTags ( FGameplayTagContainer const &  Other)

Adds all the tags from one container to this container NOTE: From set theory, this effectively is the union of the container this is called on with Other.

Parameters
OtherTagContainer that has the tags you want to add to this container

◆ CreateConstIterator()

TArray< FGameplayTag >::TConstIterator FGameplayTagContainer::CreateConstIterator ( ) const
inline

Creates a const iterator for the contents of this array

◆ CreateFromArray()

template<class AllocatorType >
static FGameplayTagContainer FGameplayTagContainer::CreateFromArray ( const TArray< FGameplayTag, AllocatorType > &  SourceTags)
inlinestatic

Creates a container from an array of tags, this is more efficient than adding them all individually

◆ FillParentTags()

void FGameplayTagContainer::FillParentTags ( )

Fills in ParentTags from GameplayTags

◆ Filter()

FGameplayTagContainer FGameplayTagContainer::Filter ( const FGameplayTagContainer OtherContainer) const

Returns a filtered version of this container, returns all tags that match against any of the tags in OtherContainer, expanding parents

Parameters
OtherContainerThe Container to filter against
Returns
A FGameplayTagContainer containing the filtered tags

◆ FilterExact()

FGameplayTagContainer FGameplayTagContainer::FilterExact ( const FGameplayTagContainer OtherContainer) const

Returns a filtered version of this container, returns all tags that match exactly one in OtherContainer

Parameters
OtherContainerThe Container to filter against
Returns
A FGameplayTagContainer containing the filtered tags

◆ First()

FGameplayTag FGameplayTagContainer::First ( ) const
inline

◆ FromExportString()

void FGameplayTagContainer::FromExportString ( const FString &  ExportString,
int32  PortFlags = 0 
)

Sets from a ImportText string, used in asset registry

◆ GetByIndex()

FGameplayTag FGameplayTagContainer::GetByIndex ( int32  Index) const
inline

◆ GetGameplayTagArray() [1/2]

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

Gets the explicit list of gameplay tags

◆ GetGameplayTagArray() [2/2]

void FGameplayTagContainer::GetGameplayTagArray ( TArray< FGameplayTag > &  InOutGameplayTags) const
inline

Gets the explicit list of gameplay tags

◆ GetGameplayTagParents()

FGameplayTagContainer FGameplayTagContainer::GetGameplayTagParents ( ) const

Returns a new container explicitly containing the tags of this container and all of their parent tags

◆ HasAll()

bool FGameplayTagContainer::HasAll ( const FGameplayTagContainer ContainerToCheck) const
inline

Checks if this container contains ALL of the tags in the specified container, also checks against parent tags {"A.1","B.1"}.HasAll({"A","B"}) will return True, {"A","B"}.HasAll({"A.1","B.1"}) will return False If ContainerToCheck is empty/invalid it will always return True, because there were no failed checks

Returns
True if this container has ALL of the tags of in ContainerToCheck, including if ContainerToCheck is empty

◆ HasAllExact()

bool FGameplayTagContainer::HasAllExact ( const FGameplayTagContainer ContainerToCheck) const
inline

Checks if this container contains ALL of the tags in the specified container, only allowing exact matches {"A.1","B.1"}.HasAll({"A","B"}) will return False If ContainerToCheck is empty/invalid it will always return True, because there were no failed checks

Returns
True if this container has ALL of the tags of in ContainerToCheck, including if ContainerToCheck is empty

◆ HasAny()

bool FGameplayTagContainer::HasAny ( const FGameplayTagContainer ContainerToCheck) const
inline

Checks if this container contains ANY of the tags in the specified container, also checks against parent tags {"A.1"}.HasAny({"A","B"}) will return True, {"A"}.HasAny({"A.1","B"}) will return False If ContainerToCheck is empty/invalid it will always return False

Returns
True if this container has ANY of the tags of in ContainerToCheck

◆ HasAnyExact()

bool FGameplayTagContainer::HasAnyExact ( const FGameplayTagContainer ContainerToCheck) const
inline

Checks if this container contains ANY of the tags in the specified container, only allowing exact matches {"A.1"}.HasAny({"A","B"}) will return False If ContainerToCheck is empty/invalid it will always return False

Returns
True if this container has ANY of the tags of in ContainerToCheck

◆ HasTag()

bool FGameplayTagContainer::HasTag ( const FGameplayTag TagToCheck) const
inline

Determine if TagToCheck is present in this container, also checking against parent tags {"A.1"}.HasTag("A") will return True, {"A"}.HasTag("A.1") will return False If TagToCheck is not Valid it will always return False

Returns
True if TagToCheck is in this container, false if it is not

◆ HasTagExact()

bool FGameplayTagContainer::HasTagExact ( const FGameplayTag TagToCheck) const
inline

Determine if TagToCheck is explicitly present in this container, only allowing exact matches {"A.1"}.HasTagExact("A") will return False If TagToCheck is not Valid it will always return False

Returns
True if TagToCheck is in this container, false if it is not

◆ ImportTextItem()

bool FGameplayTagContainer::ImportTextItem ( const TCHAR *&  Buffer,
int32  PortFlags,
UObject Parent,
FOutputDevice ErrorText 
)

Handles fixup after importing from text

◆ IsEmpty()

bool FGameplayTagContainer::IsEmpty ( ) const
inline

Returns true if container is empty

◆ IsValid()

bool FGameplayTagContainer::IsValid ( ) const
inline

Returns whether the container has any valid tags

◆ IsValidIndex()

bool FGameplayTagContainer::IsValidIndex ( int32  Index) const
inline

◆ Last()

FGameplayTag FGameplayTagContainer::Last ( ) const
inline

◆ MatchesQuery()

bool FGameplayTagContainer::MatchesQuery ( const struct FGameplayTagQuery Query) const

Checks if this container matches the given query.

Parameters
QueryQuery we are checking against
Returns
True if this container matches the query, false otherwise.

◆ NetSerialize()

bool FGameplayTagContainer::NetSerialize ( FArchive Ar,
class UPackageMap Map,
bool bOutSuccess 
)

Efficient network serialize, takes advantage of the dictionary

◆ Num()

int32 FGameplayTagContainer::Num ( ) const
inline

Returns the number of explicitly added tags

◆ operator!=()

bool FGameplayTagContainer::operator!= ( FGameplayTagContainer const &  Other) const

◆ operator=() [1/2]

FGameplayTagContainer & FGameplayTagContainer::operator= ( FGameplayTagContainer &&  Other)

◆ operator=() [2/2]

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

Assignment/Equality operators

◆ operator==()

bool FGameplayTagContainer::operator== ( FGameplayTagContainer const &  Other) const

◆ PostScriptConstruct()

void FGameplayTagContainer::PostScriptConstruct ( )

Fill in the ParentTags array and any other transient parameters

◆ RemoveTag()

bool FGameplayTagContainer::RemoveTag ( const FGameplayTag TagToRemove,
bool  bDeferParentTags = false 
)

Tag to remove from the container

Parameters
TagToRemoveTag to remove from the container
bDeferParentTagsSkip calling FillParentTags for performance (must be handled by calling code)

◆ RemoveTagByExplicitName()

bool FGameplayTagContainer::RemoveTagByExplicitName ( const FName TagName)
protected

If a Tag with the specified tag name explicitly exists, it will remove that tag and return true. Otherwise, it returns false. It does NOT check the TagName for validity (i.e. the tag could be obsolete and so not exist in the table). It also does NOT check parents (because it cannot do so for a tag that isn't in the table). NOTE: This function should ONLY ever be used by GameplayTagsManager when redirecting tags. Do NOT make this function public!

◆ RemoveTags()

void FGameplayTagContainer::RemoveTags ( const FGameplayTagContainer TagsToRemove)

Removes all tags in TagsToRemove from this container

Parameters
TagsToRemoveTags to remove from the container

◆ Reset()

void FGameplayTagContainer::Reset ( int32  Slack = 0)

Remove all tags from the container. Will maintain slack by default

◆ Serialize()

bool FGameplayTagContainer::Serialize ( FStructuredArchive::FSlot  Slot)

Serialize the tag container

◆ ToMatchingText()

FText FGameplayTagContainer::ToMatchingText ( EGameplayContainerMatchType  MatchType,
bool  bInvertCondition 
) const

Returns human readable description of what match is being looked for on the readable tag list.

◆ ToString()

FString FGameplayTagContainer::ToString ( ) const

Returns string version of container in ImportText format

◆ ToStringSimple()

FString FGameplayTagContainer::ToStringSimple ( bool  bQuoted = false) const

Returns abbreviated human readable Tag list without parens or property names. If bQuoted is true it will quote each tag

◆ ToStringsMaxLen()

TArray< FString > FGameplayTagContainer::ToStringsMaxLen ( int32  MaxLen) const

Returns abbreviated human readable Tag list without parens or property names, but will limit each string to specified len. This is to get around output restrictions

Friends And Related Symbol Documentation

◆ begin

TArray< FGameplayTag >::TConstIterator begin ( const FGameplayTagContainer Array)
friend

DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support.

◆ end

TArray< FGameplayTag >::TConstIterator end ( const FGameplayTagContainer Array)
friend

◆ FGameplayTag

◆ FGameplayTagNode

◆ FGameplayTagQuery

◆ FGameplayTagQueryExpression

◆ FGameplayTagRedirectors

◆ UGameplayTagsManager

Member Data Documentation

◆ EmptyContainer

const FGameplayTagContainer FGameplayTagContainer::EmptyContainer
static

An empty Gameplay Tag Container

◆ GameplayTags

TArray<FGameplayTag> FGameplayTagContainer::GameplayTags
protected

Array of gameplay tags

◆ ParentTags

TArray<FGameplayTag> FGameplayTagContainer::ParentTags
protected

Array of expanded parent tags, in addition to GameplayTags. Used to accelerate parent searches. May contain duplicates in some cases


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