Version: 2018.3 (switch to 2019.1)
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); } }

Did you find this page useful? Please give it a rating: