- Home /
shop/button opening problems due to the starting(?)
Hi everyone. I have a problem with my game scene and the button for the shop. I wanted to create a game start where I just have to tap on the screen to start running the game (just like the subway surfers start, helix jump etc.) which is working pretty well. The only problem is, that when I added the button to open the shop and tapped on it, the game started running as well which shouldn’t be the case. Does any of you have a solution for that? (that I can tap on the button and open the shop without starting the game).
If my code for that would help you to fix the problem, feel free to ask for it:)
Thanks in advance!
Answer by RageEye · Jul 25, 2020 at 04:00 PM
Hi, show your code.
or try to use
if(!EventSystem.current.IsPointerOverGameObject())
private void Update()
{
if ($$anonymous$$obileInput.Instance.Tap && !isGameStarted)
{
isGameStarted = true;
motor.StartRunning();
}
did you add this line and it still doesn't work? is it enough to touch the background or some image to start playing?
if you just need to touch the screen with no UI, this line of code will suffice
if ($$anonymous$$obileInput.Instance.Tap && !isGameStarted && !EventSystem.current.IsPointerOverGameObject())
{
isGameStarted = true;
motor.StartRunning();
}
Actually I just want to touch the screen to start the game without any UI. But when I tap on the button for the shop , the player still starts running, even with that code.
the "motor" is the player controller/movement and the $$anonymous$$obileInput is the touch input. I hope that this script could help you.
Your answer
Follow this Question
Related Questions
How to start an animation? 1 Answer
Help? Problem with GUI Text button. 1 Answer
A Problem with button listener in Start() 0 Answers
Initialising List array for use in a custom Editor 1 Answer
Info on GUI 1 Answer