i am creating sort of a vendor in my game but i need to be able to close the GUI that pops up when i enter the trigger of the vendor. so basically i just need to know how to close certain GUI that i have on my screen, not all of it though because i have things such as health and gold on the screen although in another script. my script is:
var GUIopen : boolean = false;
function OnTriggerStay(other : Collider)
{
if(other.collider.tag == "Player")
{
GUIopen = true;
}
}
function OnGUI()
{
if(GUIopen == true)
{
GUI.Box(Rect(100,90,300,100), "upgrades");
if(GUI.Button(Rect(110,110,100,20), "plus 5 speed"))
{
var go = GameObject.Find("player");
go.GetComponent(player_move).speed += 5;
}
}
}
this is placed on the vendor
↧