_input events are always triggered

Moving the mouse out of the window will still trigger the InputEventMouseMotiont action.
Is there a setting or a way to avoid it?

You can simply handle only events you are interested in. For instance, if you need to capture only a left-click:

func _unhandled_input(event):
	if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
		# do your stuff

And ignore all mouse motion events.

1 Like

The Window class has two events for this mouse_entered and mouse_exited:

Listen for these events and you will know, if the mouse cursor is currently inside or outside of the window.

1 Like

Thanks, because the building wants to follow the mouse movements, I need it.

Thanks, that’s what I wanted.

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