- Home /
Problem with my button
Hello,
First I let you know that I work on a game for mobile, so I control the Player x position with my screen, if I touch on the right my charachter go to the right and vice-versa.
I have a small problem, I have a button to access the Settings in my game, when I click it I load the Settings no problem, but as my Settings button is on the right of the screen, my player go to the right, just before my Settings Scene is loaded. And I hate it...
Do you have any solution for that minor issue ? I'm a beginner so the solution may be stupid but please help me =)
I load my new Settings Scene on top of the previous one, with LoadSceneMode.Additive, because I want the music to keep playing. When I go to the settings I stop the time with Time.timescale = 0
Answer by skagontale · Sep 25, 2020 at 01:10 PM
what is your script for the player? if it uses a trcking of where you pressed then have it so if you click where the settings is it dosnt do anything or have it so that when you press the settings button it dissables the movement for your player tomporarilly.
Answer by l3mon · Sep 25, 2020 at 05:51 PM
Is your Canvas with the settings button set to Screen Space - Overlay? In this case, the button press should not affect your player's movement.
Alternatively, you could also do a raycast and check if you hit any UI object and in this case, not move the player object.
Another "dirty" way to do it, is send a stop/halt command to the player object upon the button press.
Your answer
![](https://koobas.hobune.stream/wayback/20220613012455im_/https://answers.unity.com/themes/thub/images/avi.jpg)