# 🎫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="/files/kWQcQaI7RIzEkazUw792" alt=""><figcaption></figcaption></figure>

You can create your own tags by the Create Menu:

*Create→Malbers→Scriptables→Tag*

![](/files/-M75mXSD_JiwlIYIF8vU)

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;

![](/files/-M75n1hFbmhj5CUjCj8J)

{% 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;

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://malbersanimations.gitbook.io/animal-controller/scriptable-architecture/scriptables/tags.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
