Version: Unity 6 Preview (6000.0)
LanguageEnglish
  • C#

Component.gameObject

public GameObject gameObject;

Description

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

using UnityEngine;

public class Example : MonoBehaviour { void Start() { print(gameObject.name); } }