FGameplayTagContainer

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

Windows
MacOS
Linux

References

Module

GameplayTags

Header

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

Include

#include "GameplayTagContainer.h"

Syntax

struct FGameplayTagContainer

Remarks

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

Variables

Name Description

Protected variable

TArray< FGamepl...

 

GameplayTags

Array of gameplay tags

Protected variable

TArray< FGamepl...

 

ParentTags

Array of expanded parent tags, in addition to GameplayTags.

Constructors

Name Description

Public function

FGameplayTagContainer()

Constructors

Public function

FGameplayTagContainer

(
    FGameplayTagContainer const& Other
)

Public function

FGameplayTagContainer

(
    const FGameplayTag& Tag
)

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

Public function

FGameplayTagContainer

(
    FGameplayTagContainer&& Other
)

Destructors

Name Description

Public function

~FGameplayTagContainer()

Functions

Name Description

Public function

bool

 

AddLeafTag

(
    const FGameplayTag& TagToAdd
)

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

Protected function

void

 

AddParentsForTag

(
    const FGameplayTag& Tag
)

Adds parent tags for a single tag

Public function

void

 

AddTag

(
    const FGameplayTag& TagToAdd
)

Add the specified tag to the container

Public function

void

 

AddTagFast

(
    const FGameplayTag& TagToAdd
)

Add the specified tag to the container without checking for uniqueness

Public function

void

 

AppendMatchingTags

(
    FGameplayTagContainer const& Other...,
    FGameplayTagContainer const& Other...
)

Adds all the tags that match between the two specified containers to this container.

Public function

void

 

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.

Public function Const

bool

 

ComplexHasTag

(
    FGameplayTag const& TagToCheck,
    TEnumAsByte< EGameplayTagMatchType:...,
    TEnumAsByte< EGameplayTagMatchType:...
)

Determine if the container has the specified tag

Public function Const

TArray< FGam...

 

CreateConstIterator()

Creates a const iterator for the contents of this array

Public function Static

FGameplayTag...

 

CreateFromArray

(
    const TArray< FGameplayTag, Allocat...
)

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

Public function Const

bool

 

DoesTagContainerMatch

(
    const FGameplayTagContainer& Other...,
    TEnumAsByte< EGameplayTagMatchType:...,
    TEnumAsByte< EGameplayTagMatchType:...,
    EGameplayContainerMatchType Contain...
)

Returns true if the tags in this container match the tags in OtherContainer for the specified matching types.

Protected function Const

bool

 

DoesTagContainerMatchComplex

(
    const FGameplayTagContainer& Other...,
    TEnumAsByte< EGameplayTagMatchType:...,
    TEnumAsByte< EGameplayTagMatchType:...,
    EGameplayContainerMatchType Contain...
)

Returns true if the tags in this container match the tags in OtherContainer for the specified matching types.

Public function

void

 

FillParentTags()

Fills in ParentTags from GameplayTags

Public function Const

FGameplayTag...

 

Filter

(
    const FGameplayTagContainer& Other...
)

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

Public function Const

FGameplayTag...

 

FilterExact

(
    const FGameplayTagContainer& Other...
)

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

Public function Const

FGameplayTag

 

First()

Public function

void

 

FromExportString

(
    FString ExportString
)

Sets from a ImportText string, used in asset registry

Public function Const

FGameplayTag

 

GetByIndex

(
    int32 Index
)

Public function Const

void

 

GetGameplayTagArray

(
    TArray< FGameplayTag >& InOutGamep...
)

Gets the explicit list of gameplay tags

Public function Const

FGameplayTag...

 

GetGameplayTagParents()

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

Public function Const

bool

 

HasAll

(
    const FGameplayTagContainer& Conta...
)

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

Public function Const

bool

 

HasAllExact

(
    const FGameplayTagContainer& Conta...
)

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

Public function Const

bool

 

HasAny

(
    const FGameplayTagContainer& Conta...
)

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

Public function Const

bool

 

HasAnyExact

(
    const FGameplayTagContainer& Conta...
)

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

Public function Const

bool

 

HasTag

(
    const FGameplayTag& TagToCheck
)

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

Public function Const

bool

 

HasTagExact

(
    const FGameplayTag& TagToCheck
)

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

Public function Const

bool

 

HasTagFast

(
    FGameplayTag const& TagToCheck,
    TEnumAsByte< EGameplayTagMatchType:...,
    TEnumAsByte< EGameplayTagMatchType:...
)

Version of above that is called from conditions where you know tag is valid

Public function

bool

 

ImportTextItem

(
    const TCHAR*& Buffer,
    int32 PortFlags,
    UObject* Parent,
    FOutputDevice* ErrorText
)

Handles fixup after importing from text

Public function Const

bool

 

IsEmpty()

Returns true if container is empty

Public function Const

bool

 

IsValid()

Returns whether the container has any valid tags

Public function Const

bool

 

IsValidIndex

(
    int32 Index
)

Public function Const

FGameplayTag

 

Last()

Public function Const

bool

 

MatchesQuery

(
    const FGameplayTagQuery& Query
)

Checks if this container matches the given query.

Public function

bool

 

NetSerialize

(
    FArchive& Ar,
    UPackageMap* Map,
    bool& bOutSuccess
)

Efficient network serialize, takes advantage of the dictionary

Public function Const

int32

 

Num()

Returns the number of explicitly added tags

Public function

void

 

PostScriptConstruct()

Fill in the ParentTags array and any other transient parameters

Public function

bool

 

RemoveTag

(
    FGameplayTag TagToRemove,
    bool bDeferParentTags
)

Tag to remove from the container

Protected function

bool

 

RemoveTagByExplicitName

(
    const FName& TagName
)

If a Tag with the specified tag name explicitly exists, it will remove that tag and return true.

Public function

void

 

RemoveTags

(
    FGameplayTagContainer TagsToRemove
)

Removes all tags in TagsToRemove from this container

Public function

void

 

Reset

(
    int32 Slack
)

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

Public function

bool

 

Serialize

(
    FArchive& Ar
)

Serialize the tag container

Public function Const

FText

 

ToMatchingText

(
    EGameplayContainerMatchType MatchTy...,
    bool bInvertCondition
)

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

Public function Const

FString

 

ToString()

Returns string version of container in ImportText format

Public function Const

FString

 

ToStringSimple

(
    bool bQuoted
)

Returns abbreviated human readable Tag list without parens or property names.

Operators

Name Description

Public function Const

bool

 

operator!=

(
    FGameplayTagContainer const& Other
)

Public function

FGameplayTag...

 

operator=

(
    FGameplayTagContainer&& Other
)

Public function

FGameplayTag...

 

operator=

(
    FGameplayTagContainer const& Other
)

Assignment/Equality operators

Public function Const

bool

 

operator==

(
    FGameplayTagContainer const& Other
)

Constants

Name

Description

EmptyContainer

An empty Gameplay Tag Container

Deprecated Functions

Name Description

Public function Const

FGameplayTag...

 

Filter

Deprecated in favor of HasAll

Public function Const

bool

 

HasTag

(
    FGameplayTag const& TagToCheck,
    TEnumAsByte< EGameplayTagMatchType:...,
    TEnumAsByte< EGameplayTagMatchType:...
)

Deprecated in favor of HasTag with no parameters

Public function Const

bool

 

HasTagExplicit

(
    FGameplayTag const& TagToCheck
)

Deprecated in favor of HasTagExact

Public function Const

bool

 

MatchesAll

(
    const FGameplayTagContainer& Other,
    bool bCountEmptyAsMatch
)

Deprecated in favor of HasAll

Public function Const

bool

 

MatchesAny

(
    const FGameplayTagContainer& Other,
    bool bCountEmptyAsMatch
)

Deprecated in favor of HasAny

Public function

void

 

RemoveAllTags

(
    int32 Slack
)

Deprecated in favor of Reset

Public function

void

 

RemoveAllTagsKeepSlack()

Deprecated in favor of Reset

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback