Component.gameObject 游戏物体


var gameObject : GameObject

Description描述

The game object this component is attached to. A component is always attached to a game object.

组件附加的游戏物体。一个组件总是被附加到一个游戏物体。

  • C#

  • JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public void Awake() {print(gameObject.name);}}
print (gameObject.name);


,