Legacy Documentation: Version 5.5
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Component.tag

public string tag;

Description

The tag of this game object.

A tag can be used to identify a game object. Tags must be declared in the Tags and Layers manager before using them.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { Debug.Log("Transform Tag is: " + tag); } }