Answers for "how to make a button turn on and off and object unity"

C#
0

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;
	}
}
Posted by: Guest on October-09-2020

Code answers related to "how to make a button turn on and off and object unity"

C# Answers by Framework

Browse Popular Code Answers by Language