Topic was automatically imported from the old Question2Answer platform.
Asked By
burak
My game is based click movement. When you click a place, the game character goes to the clicked position. Then I added some buttons like “pause game”, “turn of sound”, “settings menu”. When I click the buttons, the game character goes to the position. How can I disable the movement when I click the buttons?
You can see the picture. I don’t want the movement when clicking the button.
Your code should be set up so that GUI objects consume the events first. When Godot processes inputs, they pass from the Viewport through a series of methods in priority order.
This will happen automatically if you use _unhandled_input() for your character movement, rather than _input(), which has a higher priority than GUI input.
See InputEvent for more details, including a useful flowchart of input processing.
I changed to _unhandled_input() and the problem solved.