Unity Learn home
View Tutorial Content
Steps

Activating GameObjects

Tutorial
Beginner
+10 XP
5 Mins
(2630)
Summary
How to handle the active status of GameObjects in the scene, both independently and within Hierarchies, using SetActive and activeSelf / activeInHierarchy.
This tutorial is included in the Beginner Scripting project.
Select your Unity version
Last updated: November 17, 2023
2019.3
2019.2
2019.1
2018.4
2018.3
2018.2
2018.1
2017.4
2017.3
2017.2
2017.1
5.x
4.x
Language
English
Also included in

1.Activating GameObjects

Video Player is loading.
Current Time 0:00
Duration 0:00
Loaded: 0%
Stream Type LIVE
Remaining Time 0:00
 
1x

ActiveObjects

using UnityEngine; using System.Collections; public class ActiveObjects : MonoBehaviour { void Start () { gameObject.SetActive(false); } }

CheckState

using UnityEngine; using System.Collections; public class CheckState : MonoBehaviour { public GameObject myObject; void Start () { Debug.Log("Active Self: " + myObject.activeSelf); Debug.Log("Active in Hierarchy" + myObject.activeInHierarchy); } }

Activating GameObjects
Activating GameObjects
General Tutorial Discussion
3
4
1. Activating GameObjects
24
9