How to prevent character from moving towards button?

Godot Version

<4 >


Hi everyone! In my game i have a character with move-on-click system but when i want to use a button, which appears when character enter area, it stars to move towards button.
So my question is: how to prevent character from doing that?
Here is my movement code

when the button is pressed you need to use set input as handled.


but in order to really do this correctly you need to remove input checking in your physics process.

For Character body

func _unhandled_input(event):
  if event.is_action("move") and event.is_pressed() :
    click_pos = get_globale_mouse_position() 

For Button

func _on_button_pressed():

see Using InputEvent — Godot Engine (stable) documentation in English for details

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.