Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


scene

The Scene that contains the GameObject.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public Scene scene { get; }

Examples

//Output the name of the Scene this GameObject belongs tousing UnityEngine;using UnityEngine.SceneManagement;public class Example : MonoBehaviour{ void Start() { Scene scene = gameObject.scene; Debug.Log(gameObject.name + " is from the Scene: " + scene.name); }}