- Home /
The question is answered, right answer was accepted
Unity New GUI Buttons not resposive on Touch
I have made a button to reload my scene and another one to exit the aplication once the player is dead.As all of us i am not experienced with this new GUI so i dont know if i did this right.I put my script on the camera object and it contains all the scripts for the UI. Under my canvas i put these scripts under an object and just activate it when the player dies.Under the buttons i just callled it from that script like this:
public void ReloadLevel()
{
Application.LoadLevel(Application.loadedLevel);
}
public void ExitGame()
{
Application.Quit();
}
Did i do this right or is the new UI just buggy? When i try the game on iPhone on these 2 buttons it just seems buggy because i can click them but nothing happends.Please help.Ty
Are you created GUI Texture Component?. If yes means, you must add OnGUI Function for accessing the GUI Buttons.
Answer by HarshadK · Sep 01, 2014 at 10:25 AM
You need to assign these functions to your respective buttons under the 'On Click' event for that button component of your button game object under canvas.
See UI Button tutorial for more details.
Also note that Application.Quit will not work in editor.
yes i did that but i think this is just a bug or something.
Do you have any script where you are checking mouse clicks to perform any other action?
If yes, then it usually overrides the button click event and performs the action for the mouse click.
I had the same issue and took hell out of me in finding this out.
One way to check is to add an 'on pointer exit' event to your button to check if it is actually working or not.