# Create a new Tag

## Introduction

All tags are stored inside a script named [<mark style="color:orange;">**GamePlayTag**</mark>](#user-content-fn-1)[^1], you may edit it on your own need. It is a huge Enum. Every Tag is represented by a name and a unique number.&#x20;

{% hint style="warning" %}
*The number of each tag should be unique to avoid unexpected behaviors.*
{% endhint %}

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeI3LyalgJMG2ts7pQQx8U8rrg6RoGb_HmmpV9ysGZ-Wg4rTPf4qdT6s1TsLkf3rJa4-S1LF6g8zsmIae4dapNB5SiesRsVkw2QhsTBOu7fVf6DGM_ybx3eZZ20usIGGURDrK6fd-hA2Ss8dxeEPuVVQdCu?key=Rv96SXV0rCMH8N9lwXnGWw" alt=""><figcaption><p>Script view of Tag Helper</p></figcaption></figure>

Tags are toggled on the Action State component.

For a non-script view, you can find a scriptable object named [<mark style="color:orange;">**GamePlayTagHelper**</mark>](#user-content-fn-2)[^2] in the same folder. Click on the helper and you can find all the tags listed in the Inspector.&#x20;

<figure><img src="https://2451041454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9gUBPgMhOgtHUM3SGNRf%2Fuploads%2FPY0BcRkAhPxCoffVJaSX%2Fimage.png?alt=media&#x26;token=bfd15dba-473c-48e2-8914-7bc56819098b" alt=""><figcaption><p>Inspector view of Tag Helper</p></figcaption></figure>

## Instructions

### Step1: Add a new tag in GamePlayTag

* Open [<mark style="color:orange;">**GamePlayTag**</mark>](#user-content-fn-1)[^1] in script view.&#x20;
* Add a new tag with a unique number to the GamePlayTag enum.&#x20;

<figure><img src="https://2451041454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9gUBPgMhOgtHUM3SGNRf%2Fuploads%2Fmt8XLhWKsb5lvq2MWHdD%2Fimage.png?alt=media&#x26;token=8f1880d1-8fe8-44cd-8fcd-26260d4d59d3" alt="" width="563"><figcaption><p>Example: add <em><strong>chain5</strong></em> as a new tag</p></figcaption></figure>

{% hint style="warning" %}
*There is no special constrain to the number except uniqueness.*

*However, in order to better manage the folder hierarchy, we suggest that <mark style="color:red;">numbers of the same group of tags should be close to each other</mark>.*&#x20;
{% endhint %}

### Step2: Refresh GamePlayTagHelper

* Back to Unity Project, click on [<mark style="color:orange;">**GamePlayTagHelper**</mark>](#user-content-fn-2)[^2] .
* In Inspector, right click on the helper and choose <mark style="color:orange;">**Refresh**</mark> to update it.&#x20;

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfJtywG1fZPzeoip5tPovfYnE-qUEFyL2NJFLIbRUnCOrsczy_ePj5HYb3Ko_kncirZ0ftN_Pu3is0o2h-hv_Rz2zwHIK0w2xAvt9KDJipYN75gXKNSIkvMrAYEVX6V332KnFZe8nSENVbR8PSNBHokL4CK?key=Rv96SXV0rCMH8N9lwXnGWw" alt="" width="563"><figcaption><p>Right click to Refresh</p></figcaption></figure>

* After refreshing, the new tag should be listed in *<mark style="color:orange;">**Folders/Other**</mark>*.&#x20;

<figure><img src="https://2451041454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9gUBPgMhOgtHUM3SGNRf%2Fuploads%2FEiQRqpai3bHjJAn2IXxO%2Fimage.png?alt=media&#x26;token=8f001ede-cc71-4f3f-b1b6-2bcf85b9f959" alt="" width="427"><figcaption><p>Tag Helper after refreshing</p></figcaption></figure>

### Step3: Fix Helper hierarchy

* Right click on your new tag in ***Other*** and choose <mark style="color:orange;">**Copy**</mark>.
* Go to your target folder and <mark style="color:orange;">**click +**</mark> to add a new enum here.
* Right click this tag and choose <mark style="color:orange;">**Paste**</mark> to move your tag to the correct hierarchy.
* <mark style="color:orange;">**Click -**</mark> to remove your tag from ***Other***.

<figure><img src="https://2451041454-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9gUBPgMhOgtHUM3SGNRf%2Fuploads%2FVC7X37YoM5ff6JIo1Vvp%2Fimage.png?alt=media&#x26;token=8a43422d-6e5f-4165-b86d-279218b6bed4" alt="" width="420"><figcaption><p>Tag Helper after fixing the hierarchy</p></figcaption></figure>

[^1]: Path: *<mark style="color:blue;">/Core/Scripts/GamePlayTags/ GamePlayTag</mark>*

[^2]: Path: *<mark style="color:blue;">/Core/Scripts/GamePlayTags/ GamePlayerTagHelper</mark>*
