- Home /
Touch input is acceptable on full screen
Hi, I am developing a simple infinite runner game. There are 3 windows (Start, Game and GameOver). On the GameOver window there is a Replay button. The user is supposed to use this to restart the game. The issue is, the user is able to click/touch anywhere on the screen to restart the game. I don't want it this way. The user should be able to click/touch only on the Replay button area to restart the game.
The method I have used for this button is quite simple. It just toggles activity of the panels and somehow it's getting applied to the whole screen instead of only this Replay button.
One more thing - The same method is working properly on Start Screen where the Play button is. There are two buttons (i.e. Start game and mute) on Start screen whereas there is only one button on GameOver Screen (i.e. Replay)
I am not much of a coder and I almost checked 100 questions on this forum but couldn't find the answer. I would really appreciate if you come up with a solution.
Answer by AmirBraham · Jul 06, 2016 at 08:15 PM
Hi , I didn't quite understand your method but here's an alternative and propre way of doing it : Create an empty gameobject called LevelManager , add a c# script to it . add to it
public void PauseGame () {
//your code for stopping the game
}
Now go back to your UI button and on the Button component where it says On click () , attack your LevelManager and add the PauseGame function
Your answer
Follow this Question
Related Questions
How can we access individual particles by touch? 0 Answers
Glow (Area Light) disappears when touched ? 1 Answer
I can't make this more reliable 1 Answer
Camera rotation as per swipe speed & it has to slow down as gradually? 0 Answers
Collision detection when objects already touch at runtime 1 Answer