- Home /
Touch screen on Android to pause the game
Hello people,
Please i have a very very big problem, that i cant solve since a few days:
I have a sphere and it jumps every time the screen is touched. At the bottom left of the screen, I have a (UI) pause button (See Image). The problem is that, as soon as I touch the Pause button to pause the game, the sphere also jumps parallel.
What I have done: i added a raycast to the main camera and the interface IPointerClickHandler to script which is attached to the pause button. And then i implemented the code for the pause in the public function void OnPointerClick (PointerEventData EventData). But it is still not working.
This video didnt help me https://www.youtube.com/watch?v=EVZiv7DLU6E:
i also read and applied many answers in forum http://forum.unity3d.com/threads/ispointerovereventsystemobject-always-returns-false-on-mobile.265372/
http://answers.unity3d.com/questions/664139/raycastingtouches-with-timescale-0-c.html but it always didnt work !!
I have unity 5.0.4 . I dont understand what is wrong. My hierarchy:
main camera
sphere // contains the script with jump code in void update() {if Input.to...
canvas
pausebutton //contains the script for pause
eventsystem
cube
cube...
I hope, you can help me to understand what is wrong, thank u !!
I'm trying to figure out a similar problem. The video you link to gives 3 ways of dealing with, have you tried all of them? If you have an object underneath your pause menu this video deals with that exactly.
$$anonymous$$y situation is that I have the "$$anonymous$$enu/Esc/Pause" button on the top corner (taken from UI sample asset) and my game is a simple "Fire1" touch entire screen (to make character do something) and when I click the $$anonymous$$enu button it shows the menu and pauses but also activates the Fire1 at the same time! I set the canvas to priority 1 (layer) but that didn't work. I'm going to try to make the entire screen a button but there's probably an easier method I don't know about.
(on desktop it's designed to open menu by pressing "escape" here but on mobile the person would have to touch the menu button and there is no "escape" key so I have to get it to work by touching, without making the Fire1 active at the same time).
This tends to be a common issue and I am still dealing with the problem. Did you find any suitable solution? Thanks!
Your answer
Follow this Question
Related Questions
[5.4 - Unity2D - Android] UI Button Requires Child Text? 0 Answers
I am making android fps and my raycast shooting button don't work. What I should do? 1 Answer
Android Pause conflicting with action 1 Answer
5.5.1f1 new UI system: Button in scrollview is not working on Android. 2 Answers
UI Button not working on Android 7 Answers