using UnityEngine;
using System.Collections;
public class button : MonoBehaviour {
public GameObject object1;
void Start ()
{
GameObject.Find("object1").SetActive(true);
}
// Update is called once per frame
void OnMouseDown ()
{
GameObject.Find("object1").SetActive(false);
}
}
and i want disable or enable some game object in game which a select, but it doesn’t work if i click on button. I am new in unity and C# so maybe i make big wrong.
Thanks for answers.
This code will enable the gameobject you attaced if it was already disable or it will enable the gameobject you attached if it was disable. If you simply want it to be disable on button click use the one below.