Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

how to remove GUI from screen by clicking on a GUI button

$
0
0
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

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>