# 🎫Tags

## Overview

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

It uses the **Tag** scriptable assets with Integer ID values.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FTdTBr8L7dY485j159Y3b%2Fimage.png?alt=media&#x26;token=9a61ecd3-deb6-4a91-a324-f9deccc7eca7" alt=""><figcaption></figcaption></figure>

You can create your own tags by the Create Menu:

*Create→Malbers→Scriptables→Tag*

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M6p9rcRrg4Os4QVwfzb%2F-M75mXSD_JiwlIYIF8vU%2Fimage.png?alt=media\&token=5e40c49b-6edc-4ffb-8f5e-f73d87d97401)

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 **"**&#x43;ompanion" tag is the HashCode \[-780357772]&#x20;

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M6p9rcRrg4Os4QVwfzb%2F-M75n1hFbmhj5CUjCj8J%2Fimage.png?alt=media\&token=b8667735-7da5-4057-8baa-2e2d4632e6fd)

{% hint style="success" %}
To know if a **gameObject** or a **transform** has a **Tag(s)** you can use the Extension methods:
{% endhint %}

```csharp
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.&#x20;

###
