🎫Tags

Overview

The Tags component allows gameobjects to have multiple tags.. instead of one.

It uses the Tag scriptable assets with Integer ID values.

You can create your own tags by the Create Menu:

Create→Malbers→Scriptables→Tag

The ID for a Tag is created automatically using the method GetHashCode(). Which means Tags IDs are Case sensitive

For example, the ID for the "Companion" tag is the HashCode [-780357772]

To know if a gameObject or a transform has a Tag(s) you can use the Extension methods:

if (transform.HasMalbersTag(myTag))
{
   //Do your thing
}

//OR

if (gameobject.HasMalbersTag(myTag))
{
   //Do your thing
}

//OR

if (transform.HasMalbersTag(myTag1, myTag2))
{
   //Do your thing
}

Methods & Properties

static List<Tags> TagsHolders

Returns a List of all objects that use the Tags component. You can access from everywhere like this:

Tags.TagsHolders

static List GambeObjectbyTag(Tag tag)

Returns a List of all gameobjects in the current scene that have a tag. You can access from everywhere like this:

Tags.GambeObjectbyTag(myTag)

static List GambeObjectbyTag(int tag)

same as static List GambeObjectbyTag(Tag tag) but uses the int value of the tag

bool HasTag(Tag tag)

Check if this component has a tag.

Last updated