> For the complete documentation index, see [llms.txt](https://varian.gitbook.io/varian-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://varian.gitbook.io/varian-docs/object-tags/object-tags.md).

# Object Tags

A simple subsystem that allows you to add a tag to any object. This includes actors, widgets, everything that derives from `UObject` can have a tag!

You can add/remove tags through the regular `AddTagsToObject` or `RemoveTagsFromObject`function.&#x20;

<figure><img src="https://2777676461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjP5XAKMs1xUM2psZ0ZK9%2Fuploads%2FEumro3XqTzlU40LlBmCi%2Fimage.png?alt=media&amp;token=d4397740-9e2d-4e50-87d4-e15f2c213008" alt=""><figcaption></figcaption></figure>

You can also use `TagRelationship`'s to create tags that are incompatible with each other. Such as a `Alive` tag automatically being removed if a `Dead` tag is applied.

<div align="center"><img src="https://github.com/Variann/ModularityPractice/assets/6917153/17a1f573-b64e-4623-86bb-db82cfd8578d" alt="image"></div>

* The system also comes with a `Listener` system, which allows other objects to trigger gameplay logic when another objects tags are updated.
* There is a `TagHistory` system meant for development and aid debugging to help identify who added/removed tags for itself or another object.

## Base Classes

* O\_TagRelationship - Relationship class to associate a relationship between a tag and other tags.

## GAS integration

The plugin already automatically adds any tags you add as a LooseGameplayTag to the target if it is an actor and has a Ability component, but not the other way around. This way, whenever you try to activate an ability and it has a `BlockingTag` or `RequiredTags`, then it'll automatically have the tag you added to the actor through the subsystem.

To have the subsystem pick up any tags that GAS applies, you will want to make your own `ASC` component and override the `OnTagUpdated` function and implement this logic:

![image](https://github.com/Variann/ModularityPractice/assets/6917153/ebded181-7560-4e99-9941-57fb73c57d51)

![image](https://github.com/Variann/ModularityPractice/assets/6917153/b4251317-c7df-4b67-b2f1-2f2e87442dc7)

This setup will ensure that abilities, effects and any other components of `GAS` will update the `ObjectTags` subsystem.

Though this won't handle `TagRelationship`'s, you'll have to integrate that yourself or manage the tags in a way to not include tags that might be in a complicated relationship.

## Performance

Virtually free. Inclusive call average costs:

* `GetObjectTags` - 12k calls, average time: 1.6 microseconds
* `AddTagToObject` - 9k calls, average time: 1.7 microseconds
* `RemoveTagsFromObject` - 9k calls, average time: 0.5 microseconds

## Debugging

### Console commands

* `AddTag` and `AddTagToPlayer` : Adds a tag to the actor in front of the camera or the player. This accepts 2 optional floats. A value to assign to the tag, and a duration.
* `RemoveTag` and `RemoveTagFromPlayer` : Remove a tag from the actor in front of the camera or the player.
* `ToggleViewActorTags` : Toggle drawing text over all actors in the level with their tags.

### Cog

This section implies that you have a basic `Cog` plugin setup.

* The `ObjectTags` window debugger class is called `FCogObjectTagsWindow`.<br>

  <figure><img src="https://2777676461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjP5XAKMs1xUM2psZ0ZK9%2Fuploads%2Fjfi9csZeac35UYxgiWsn%2Fimage.png?alt=media&amp;token=6330ad6f-bebc-4076-a0df-eada24b83ec0" alt=""><figcaption></figcaption></figure>
