- Home /
Question by
Premo36 · Dec 27, 2014 at 08:05 PM ·
mouseclickmouse position
Do not allow "click" on anithing unless it's in a GUI.Box
Hello, how can I prevent the player to interact (So do not click on objects with the function OnMouseDown, click buttons etc... practically anything that can be activated with a mouse click) beyond the buttons that are in a Gui.box screen area? Here's my script:
#pragma strict
var Gui : boolean;
function OnMouseDown()
{
Gui = true;
}
function OnGUI () {
if(Gui == true){
//This is the gui.box
GUI.Box (Rect (10,10,100,90), "The area");
//Those are the buttons the can be clicked
//This one do something
if (GUI.Button (Rect (20,40,80,20), "Button")) {
//Something
}
//This is the button that close the Gui and will allow the player to interact with everything
if (GUI.Button (Rect (20,70,80,20), "Close")) {
Gui = false;
}
}
}
Thanks!
Comment