How to simulate a mouse click with a controller Input

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CoolJoey

Is there a way to use an action/Input and make it simulate a mouse click? I know you can simulate a mouse moving and I have that in my game I just want to make it so that when I press an Input it causes the mouse to click.

:bust_in_silhouette: Reply From: rossunger

You can generate an input event using InputEventMouseButton.new() and set parameters such as pressed, and button_index

You can then call that event using get_tree().input_event(YOUR INPUT EVENT)

I am having the same Issue as before that I keep getting a stack overflow error… What do I do

CoolJoey | 2022-02-13 12:41

You might need to post some code to show us what’s going on.

rossunger | 2022-02-13 13:40

Is there a difference to calling Input.parse_input_event()?

As this is referenced in the docs.

Background is that I want a LineEdit to be clicked so the caret appears after the Node was set to readonly. Which doesn’t work for me though testing the events via _input() makes them seem identical.

Dri | 2022-06-12 22:06