I am making a game and i want that in the main menu whenever the player touchs the screen the game would start.(the pass to start the game works) the only problem is that i have another buttons in the screen(like mute button or button to get into the store) and when i click them nothing happens because its passing the player to the game.
if (GUI.Button(Rect(0 ,0 ,100 ,100),"" , muteButton)){//Mute button
//Code to mute
}
if(Input.GetMouseButtonUp(0)){//TapAnywhere
//Start the game
}
I tried it with else if and its still doesn’t work.(And all the code is in GUI Function)
You either make sure that the mouse click position (REF happens in the area without button (i.e. bottom 80% of the screen) or even simpler create a very big invisible button which will start the game. For that you will need to drop using old GUI.button and use some more evolved solution like Unity UI (version 4.6 upwards) or NGUI. In that way you can adjust collider to not overlap with other buttons. If you really need the area to touch to start the game to be anywhere even between your other buttons, than set this button depth to lower (so its below the other buttons), that would work with NGUI not sure about unity canvas. If you however want to stick to use basic GUI.buttons track mouse click position and only start the game when is not overlapping the screen. In practice this area dont need to cover entire screen just big chunk of the middle.