- Home /
Question by
MD-Unlimited · Aug 25, 2011 at 03:52 PM ·
guiios
Trigger a GUI when tapping and object in IOS
Hi I was wondering if there was away to activate an GUI when tapping an object on the IPad. I know how to load a new scene but i want to load the GUI over the game. Basically i want to create a character info GUI when selecting the character it will popup. I'm new to coding but trying my hardest to come to terms with it. If anyone can help with a script and send me in the right direction I would really appreciate it.
Many thanks
Comment
Answer by Rennat · Aug 25, 2011 at 04:17 PM
I think the easiest way to do this is to have conditionals like so
javascript : MyGUI.js
var hud : boolean = true; var characterInfo : boolean = false; var pause : boolean = false;
function OnGUI () {
if (hud) {
// show the hud
}
if (characterInfo) {
// show the character info
}
if (pause) {
// show the pause menu
}
}
function Update () {
// Turn them off and on however you like.
if (Input.GetButtonDown("ToggleHUD"))
hud = !hud;
if (Input.GetButtonDown("ToggleCharacterInfo"))
characterInfo = !characterInfo;
if (Input.GetButtonDown("Pause"))
pause = !pause;
}