# IsTag(string)

> Checks whether the animation state has the specified tag.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.AnimationModule

```csharp
public bool IsTag(string tag)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The tag to check.

### Returns

| Type                                                          | Description                                                         |
| ------------------------------------------------------------- | ------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the animation state has the specified tag, false otherwise. |

### Remarks

You can manually set a tag for each state in the [Animator State inspector](/engine/6000.7/manual/animation-section/animation-mecanim/animation-animator-controller/animation-state-machines/class-state.md) or with the [\_tag](/engine/6000.7/script-reference/unityeditor/animations/animatorstate/tag.md) property. Use [AnimatorStateInfo.IsTag](/engine/6000.7/script-reference/unityengine/animatorstateinfo/istag.md) to query if an activate state in the [Animator](/engine/6000.7/script-reference/unityengine/animator.md) component has a tag that matches a specific string. [AnimatorStateInfo.IsTag](/engine/6000.7/script-reference/unityengine/animatorstateinfo/istag.md) calls [Animator.StringToHash](/engine/6000.7/script-reference/unityengine/animator/stringtohash.md) on the tag parameter and compares it to [\_tagHash](/engine/6000.7/script-reference/unityengine/animatorstateinfo/taghash.md) internally; if you call that method often, consider precomputing the hash of the tag for a gain in performance.

Additional Resources: [AnimatorStateInfo.IsName](/engine/6000.7/script-reference/unityengine/animatorstateinfo/isname.md), [\_tag](/engine/6000.7/script-reference/unityeditor/animations/animatorstate/tag.md)

### Examples

```csharp
// This script demonstrates how to check if the current state of an Animator is tagged with a specific tag.

using UnityEngine;

[RequireComponent(typeof(Animator))]
public class AnimatorStateInfoIsTagExample : MonoBehaviour
{
    // The tag to check for.
    public string tagName = "Jump";

    // The Animator component on the GameObject this script is attached to.
    Animator m_Animator;

    void Start()
    {
        m_Animator = GetComponent<Animator>();
    }

    void Update()
    {
        // If the current state is tagged with the specified tag, log a message.
        var stateInfo = m_Animator.GetCurrentAnimatorStateInfo(0);
        if (stateInfo.IsTag(tagName))
        {
            Debug.Log($"Current state is tagged as {tagName}");
        }
    }
}
```
