how to make a button turn on and off and object unity
public GameObject Obj;
bool YesNo = false;
void start()
{
Obj.SetActive(false);
}
public void Button()
{
if(YesNo == true)
{
Obj.SetActive(false);
YesNo = false;
}
else if(YesNo == false)
{
Obj.SetActive(true);
YesNo = true;
}
}