![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <GameplayTagContainer.h>
Inheritance diagram for FGameplayTagContainer: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< FGameplayTag > | GameplayTags |
| TArray< FGameplayTag > | ParentTags |
A Tag Container holds a collection of FGameplayTags, tags are included explicitly by adding them, and implicitly from adding child tags
|
inline |
Constructors
|
inline |
|
inlineexplicit |
Explicit to prevent people from accidentally using the wrong type of operation
|
inline |
|
inline |
| bool FGameplayTagContainer::AddLeafTag | ( | const FGameplayTag & | TagToAdd | ) |
Adds a tag to the container and removes any direct parents, wont add if child already exists
| Tag | The tag to try and add to this container |
|
protected |
| void FGameplayTagContainer::AddTag | ( | const FGameplayTag & | TagToAdd | ) |
Add the specified tag to the container
| TagToAdd | Tag to add to the container |
| void FGameplayTagContainer::AddTagFast | ( | const FGameplayTag & | TagToAdd | ) |
Add the specified tag to the container without checking for uniqueness
| TagToAdd | Tag to add to the container |
Useful when building container from another data struct (TMap for example)
| 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).
| OtherA | TagContainer that has the matching tags you want to add to this container, these tags have their parents expanded |
| OtherB | TagContainer used to check for matching tags. If the tag matches on any parent, it counts as a match. |
| 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.
| Other | TagContainer that has the tags you want to add to this container |
|
inline |
Creates a const iterator for the contents of this array
|
inlinestatic |
Creates a container from an array of tags, this is more efficient than adding them all individually
| void FGameplayTagContainer::FillParentTags | ( | ) |
Fills in ParentTags from GameplayTags
| 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
| OtherContainer | The Container to filter against |
| FGameplayTagContainer FGameplayTagContainer::FilterExact | ( | const FGameplayTagContainer & | OtherContainer | ) | const |
Returns a filtered version of this container, returns all tags that match exactly one in OtherContainer
| OtherContainer | The Container to filter against |
|
inline |
Sets from a ImportText string, used in asset registry
|
inline |
| const TArray< FGameplayTag > & FGameplayTagContainer::GetGameplayTagArray | ( | ) | const |
Gets the explicit list of gameplay tags
|
inline |
Gets the explicit list of gameplay tags
| FGameplayTagContainer FGameplayTagContainer::GetGameplayTagParents | ( | ) | const |
Returns a new container explicitly containing the tags of this container and all of their parent tags
|
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
|
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
|
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
|
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
|
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
|
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
| bool FGameplayTagContainer::ImportTextItem | ( | const TCHAR *& | Buffer, |
| int32 | PortFlags, | ||
| UObject * | Parent, | ||
| FOutputDevice * | ErrorText | ||
| ) |
Handles fixup after importing from text
|
inline |
Returns true if container is empty
|
inline |
Returns whether the container has any valid tags
|
inline |
| bool FGameplayTagContainer::MatchesQuery | ( | const struct FGameplayTagQuery & | Query | ) | const |
Checks if this container matches the given query.
| Query | Query we are checking against |
| bool FGameplayTagContainer::NetSerialize | ( | FArchive & | Ar, |
| class UPackageMap * | Map, | ||
| bool & | bOutSuccess | ||
| ) |
Efficient network serialize, takes advantage of the dictionary
|
inline |
Returns the number of explicitly added tags
| bool FGameplayTagContainer::operator!= | ( | FGameplayTagContainer const & | Other | ) | const |
| FGameplayTagContainer & FGameplayTagContainer::operator= | ( | FGameplayTagContainer && | Other | ) |
| FGameplayTagContainer & FGameplayTagContainer::operator= | ( | FGameplayTagContainer const & | Other | ) |
Assignment/Equality operators
| bool FGameplayTagContainer::operator== | ( | FGameplayTagContainer const & | Other | ) | const |
| void FGameplayTagContainer::PostScriptConstruct | ( | ) |
Fill in the ParentTags array and any other transient parameters
| bool FGameplayTagContainer::RemoveTag | ( | const FGameplayTag & | TagToRemove, |
| bool | bDeferParentTags = false |
||
| ) |
Tag to remove from the container
| TagToRemove | Tag to remove from the container |
| bDeferParentTags | Skip calling FillParentTags for performance (must be handled by calling code) |
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!
| void FGameplayTagContainer::RemoveTags | ( | const FGameplayTagContainer & | TagsToRemove | ) |
Removes all tags in TagsToRemove from this container
| TagsToRemove | Tags to remove from the container |
Remove all tags from the container. Will maintain slack by default
| bool FGameplayTagContainer::Serialize | ( | FStructuredArchive::FSlot | Slot | ) |
Serialize the tag container
| FText FGameplayTagContainer::ToMatchingText | ( | EGameplayContainerMatchType | MatchType, |
| bool | bInvertCondition | ||
| ) | const |
Returns human readable description of what match is being looked for on the readable tag list.
| FString FGameplayTagContainer::ToString | ( | ) | const |
Returns string version of container in ImportText format
Returns abbreviated human readable Tag list without parens or property names. If bQuoted is true it will quote each tag
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
|
friend |
DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
static |
An empty Gameplay Tag Container
|
protected |
Array of gameplay tags
|
protected |
Array of expanded parent tags, in addition to GameplayTags. Used to accelerate parent searches. May contain duplicates in some cases