GameObject.SetActive

function SetActive (value : boolean) : void

Description

Activates/Deactivates the GameObject.

Note that a GameObject may be inactive because a parent is not active. In that case, calling SetActive() will not activate it, but only set the local state of the GameObject, which can be checked using GameObject.activeSelf. This state will then be used once all parents are active.

See Also: GameObject.activeSelf, GameObject.activeInHierarchy.

JavaScript
    // Deactivates the game object.
gameObject.SetActive (false);

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void Example() {
gameObject.SetActive(false);
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Example():
gameObject.SetActive(false)