Component.tag 标签


var tag : string

Description描述

The tag of this game object.

游戏物体的标签。

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

标签可以用来识别游戏物体,标签必须在 使用它们之前在标签管理器中定义。

  • C#

  • JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public void Awake() {Debug.Log("Transform Tag is: " + tag);}}
//打印这个Transform的标签Debug.Log("Transform Tag is: " + tag);


,