GameplayTags¶
15 tools for gameplay tags, tag tables and redirects, and the tags of an object.
Back to the index.
add_gameplay_tag_redirect¶
Additive Idempotent
Add an entry to UGameplayTagsSettings::GameplayTagRedirects (the persistent redirect config), then call FGameplayTagRedirectors::RefreshTagRedirects() so the runtime map picks it up. Idempotent (same Old->New pair returns already_present=true). Requires a ConfigRestartRequired=true flag — UGameplayTagsSettings flags it as such; callers should note that the running game still resolves Old to itself until next process restart in Shipping, but in the editor the redirect is live immediately.
| Parameter | Type | Required | Description |
|---|---|---|---|
old_tag_name |
string | yes | Source tag name (FName). |
new_tag_name |
string | yes | Destination tag name (FName). |
Returns: { old_tag_name, new_tag_name, added: bool, already_present: bool, total_redirects: int, needs_restart: bool }
add_gameplay_tag_to_table¶
Additive
Add one tag (with an optional developer comment) as a row in a gameplay tag DataTable, verifying the write by read-back. The team-friendly way to declare tags: it touches only this asset instead of rewriting the shared DefaultGameplayTags.ini the way create_gameplay_tag does. The trade-off is that a tag added here is not registered LIVE, so it may not resolve until the table is reloaded -- if you must use it in the same session, check with get_gameplay_tag_info first.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Full asset path of the gameplay tag data table |
tag |
string | yes | The gameplay tag string used as both row Tag and row name |
dev_comment |
string | no | Optional developer comment for the row |
Returns: { table_path: string, tag: string, row_name: string, dev_comment: string, verified: bool, saved: bool, row_count: int, success: bool, message: string }
add_tag_to_object¶
Additive
Grant a gameplay tag to an object that implements IGameplayTagAssetInterface -- the way to put an actor into a state (stunned, wet, on fire, alerted) so that tag-driven systems react without any of them knowing about each other. Reports already_present and echoes the resulting tag list, so the reply is its own oracle. Register the tag first (get_gameplay_tag_info / create_gameplay_tag): an unregistered string resolves to an empty tag and is added as nothing.
| Parameter | Type | Required | Description |
|---|---|---|---|
object_path |
string | yes | Path or name of the object to add the tag to |
tag_name |
string | yes | Name of the tag to add |
Returns: { object_path: string, tag_name: string, success: bool, already_present: bool, message: string, tags: [string] }
create_gameplay_tag¶
Destructive
Add a new gameplay tag to the project's DefaultGameplayTags.ini AND register it LIVE in this editor session -- that live half is why you must call this before writing the tag into a DataTable row or a property, since an unregistered tag string is silently reset to None by the importers. But it REWRITES THE WHOLE INI: the list comes back alphabetised, every comment block is deleted, and other tags' DevComments are re-serialised and normalised, so adding one tag can produce a diff full of unrelated insertions and deletions. Copy the ini first; the oracle is git diff --stat showing your N insertions and ZERO deletions, and if not, git checkout the ini and re-insert only your line (the tag stays registered live either way -- confirm with get_gameplay_tag_info).
| Parameter | Type | Required | Description |
|---|---|---|---|
tag_name |
string | yes | Name of the gameplay tag to create or check |
dev_comment |
string | no | Optional developer comment for the tag |
source_name |
string | no | Optional explicit source INI name |
Returns: { tag_name: string, success: bool, tag_string: string, message: string }
create_gameplay_tag_table¶
Additive
Create a DataTable of gameplay tags (row struct FGameplayTagTableRow) -- the alternative to declaring tags in DefaultGameplayTags.ini, and the better choice for a large or team-owned tag set: rows merge and diff like data instead of fighting over one ini that the create_gameplay_tag path rewrites end to end. The table must be registered in the project's gameplay tag settings to be loaded. Fill it with add_gameplay_tag_to_table and check it with get_gameplay_tag_table_rows (valid, missing_tags).
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Asset name for the new data table, e.g. GT_MyTags |
package_path |
string | no | Target content path, defaults to /Game/GameplayTags |
Returns: { name: string, package_path: string, table_path: string, row_struct: string, success: bool, already_exists: bool, saved: bool, message: string }
find_gameplay_tags¶
Read-only
Search the registered gameplay tags for everything under a tag -- the discovery call for "what tags exist under Material.Wood" or "is there already a tag for this" -- or, with no query_tag, list EVERY registered tag (the full vocabulary, plugins and vendor content included; projects run to thousands, so prefer a branch). count_only returns just the count: the cheap health probe that the registry loaded, or that create_gameplay_tag registered (compare before and after). Sees the LIVE registry, so a tag added this session by create_gameplay_tag shows up even if the ini was restored, and one that only exists as text in a file does not. A query_tag that is not registered is an error; to test one exact string use get_gameplay_tag_info.
| Parameter | Type | Required | Description |
|---|---|---|---|
query_tag |
string | no | Optional tag whose branch to list (the tag itself and all of its descendants); omitted or empty lists every registered tag |
count_only |
boolean | no | Optional bool, default false: return count (and manager_valid) without the matching_tags list |
offset |
integer | no | Index of the first entry returned, counted from 0 (default 0). Read the next page at the reply's next_offset. |
limit |
integer | no | Most entries returned per call, 1..1000 (default 100). |
Returns: { query_tag: string, count: int (entries in this page; with count_only, every match), manager_valid: bool, matching_tags?: [{ tag_name: string, tag_string: string }], total?: int, offset?: int, limit?: int, returned?: int, truncated?: bool, next_offset?: int|null } -- matching_tags sorted by tag_name; the paging fields come with it
get_gameplay_tag_info¶
Read-only
Does this exact tag string exist and resolve right now, and if so its detail: its PARENT tag and where it is defined. found=false is a normal answer, not an error -- the precondition to check BEFORE using a tag anywhere: an unregistered tag is not an error in UE, it silently becomes an empty/None tag, and a query made with an empty tag fails exactly like a valid tag that does not match. The parent is how you walk the hierarchy (Material.Wood.Oak answers to Material.Wood); hierarchy matching is ASYMMETRIC, HasAny(A, B) only succeeds when a tag of A is B or a DESCENDANT of B, so putting a family where a leaf is expected quietly fails. The source says where the tag comes from -- native C++, DefaultGameplayTags.ini, a tag DataTable, or transient (registered live this session and NOT on disk) -- with its comment and native / restricted / explicit flags: whether a tag survives an editor restart, which file to edit to change it, and whether it is YOURS or a vendor's or the engine's before you rename or remove it. Exact lookup: use find_gameplay_tags for a branch.
| Parameter | Type | Required | Description |
|---|---|---|---|
tag_name |
string | yes | Name of the gameplay tag to look up |
Returns: { tag_name: string, found: bool, tag_string?: string, tag_name_string?: string, parent_tag?: string, source?: string, comment?: string, is_native?: bool, is_restricted?: bool, is_explicit?: bool, allow_non_restricted_children?: bool }
get_gameplay_tag_redirects¶
Read-only
List every entry configured in UGameplayTagsSettings::GameplayTagRedirects (the persistent Old->New redirect config). Read-only reader counterpart of add_gameplay_tag_redirect / remove_gameplay_tag_redirect; does NOT mutate or save.
No parameters.
Returns: { redirects: [{ old_tag_name, new_tag_name }], count: int }
get_gameplay_tag_table_rows¶
Read-only
List every tag declared in a gameplay tag DataTable (FGameplayTagTableRow), with its developer comment and whether the live tag manager has it registered -- what this table contributes to the project vocabulary, as opposed to find_gameplay_tags which returns the merged live registry from all sources. valid is false when any row's tag is not registered, and missing_tags names each such tag with its row key, so the table can be fixed or the tags registered. Read-only.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Full asset path of the gameplay tag data table |
Returns: { table_path: string, row_struct: string, rows: [{ row_name: string, tag: string, dev_comment: string, registered: bool }], row_count: int, valid: bool, missing_count: int, missing_tags: [{ tag_name: string, row_name: string }] }
get_object_tags¶
Read-only
Read the gameplay tags an object currently owns -- what the game believes this actor or asset IS (states, factions, damage types, item categories). Requires the object to implement IGameplayTagAssetInterface; anything else returns nothing, which is a fact about the interface, not about the object's data. Reads the LIVE container, so during PIE tags added at runtime appear here. has_gameplay_tags answers a specific question instead of listing everything.
| Parameter | Type | Required | Description |
|---|---|---|---|
object_path |
string | yes | Path or name of the object to get tags from |
Returns: { object_path: string, tags: [string], tag_count: int }
has_gameplay_tags¶
Read-only
Test the tags an object owns (through IGameplayTagAssetInterface, else its first FGameplayTagContainer property) against a list: match "any" (default, OR) -- the "is it any kind of X" gate: any Damage., any Status.; "all" (AND) -- the multi-condition gate: alive AND armed AND not restrained; "none" -- the blocker/immunity check: not stunned, not already burning (computed as !HasAny, so a true means "clear to proceed", not "has them"). A single tag is a one-element list. Hierarchy matching is ASYMMETRIC and this is where it bites: a requested FAMILY accepts its descendants, a requested LEAF does not accept the family, so swapping the two silently turns an always-true gate into an always-false one. When in doubt request leaf tags, which match either way. owned_tags comes back every time, so a surprising answer is diagnosable in the same call. An unregistered tag name is an error (check it with get_gameplay_tag_info).
| Parameter | Type | Required | Description |
|---|---|---|---|
object_path |
string | yes | Path of the UObject to inspect |
tags |
array | yes | Non-empty array of tag-name strings (e.g. ["Combat.Hit","Character.State.Alive"]) |
match |
string | no | Optional "any" (default) | "all" | "none": OR, AND, or the negation of OR |
Returns: { object_path: string, match: string, result: bool, has_any?: bool, has_all?: bool, has_none?: bool, requested: [string], owned_tags: [string] }
remove_gameplay_tag¶
Destructive
Delete a gameplay tag from its ini source list. Two cautions. Nothing tells you who was using it -- the engine exposes no tag reference count, so audit with find_blueprint_node_references and a binary grep of Content/ first, and add_gameplay_tag_redirect if anything still points at it. And like create_gameplay_tag this rewrites DefaultGameplayTags.ini wholesale, reordering it and dropping comments, so the oracle is git diff on the ini, not the success flag.
| Parameter | Type | Required | Description |
|---|---|---|---|
tag |
string | yes | Gameplay tag string to remove, e.g. MyGame.Temp |
Returns: { tag: string, success: bool, was_present: bool, delete_returned: bool, removed: bool, message: string }
remove_gameplay_tag_from_table¶
Destructive Idempotent
Remove a gameplay tag row (by tag, the row name) from a FGameplayTagTableRow data table. Idempotent: a missing row reports already_absent without error. The remove counterpart of add_gameplay_tag_to_table.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Full asset path of the gameplay tag data table. |
tag |
string | yes | The gameplay tag string identifying the row to remove (used as the row name). |
Returns: { table_path: string, tag: string, row_name: string, removed: bool, already_absent: bool, row_count: int, saved: bool }
remove_gameplay_tag_redirect¶
Destructive
Delete the gameplay tag redirect(s) that rewrite a given old tag name -- cleanup once every asset has been resaved and nothing references the old name any more. Removing it too early silently breaks whatever still points at the old tag, since an unresolved tag becomes empty rather than an error. If the same old name was rewritten more than once over time there will be several entries: remove_all=true clears them all, and removed_count tells you how many went.
| Parameter | Type | Required | Description |
|---|---|---|---|
old_tag_name |
string | yes | Source tag name to unmap. |
remove_all |
boolean | no | If true (default false), remove every redirect with that OldTagName. |
Returns: { old_tag_name, removed_count: int, already_absent: bool, total_redirects: int }
remove_tag_from_object¶
Destructive
Take a gameplay tag off an object implementing IGameplayTagAssetInterface -- clearing a state (no longer stunned, no longer burning) so the systems keyed on it stop reacting. The was_present flag distinguishes "removed it" from "it was never there", and the reply echoes the remaining tags. Exact match only: removing a parent tag does not remove its children.
| Parameter | Type | Required | Description |
|---|---|---|---|
object_path |
string | yes | Path or name of the object to remove the tag from |
tag_name |
string | yes | Name of the tag to remove |
Returns: { object_path: string, tag_name: string, success: bool, was_present: bool, message: string, tags: [string] }