0 votes

To simulate a totally real click, is it enough to use the javascript .click() method?
Or do I have to dispatch the click event?
Or what can I do?

in Engine by (12 points)

1 Answer

+2 votes

Javascript isn't among the languages officially supported by Godot. If your question is about faking a mouse click event in Godot, the (GDScript-)answer would be:

var fake_input = InputEventMouseButton.new()
fake_input.button_index = BUTTON_LEFT
fake_input.doubleclick = false
fake_input.pressed = true
get_tree().input_event(fake_input)
by (10,610 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.