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 RemoveTagsFromObjectfunction.

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.

image
  • 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
image

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.

Last updated