I would like to simulate a mouse click on to a texture button via GDScript.
So I tried the following function:
# main_btn.button is a TextureButton instance
var event = InputEventMouseButton.new()
event.position = main_btn.button.rect_global_position
event.button_index = BUTTON_LEFT
event.pressed = true
event.pressed = false
In this code
main_btn.button is a
Then calling that function like this:
while processing a mouse click on to another button does nothing.
The texture (toggle) button does not change its texture, it's logic is not being processed.
Any ideas what I am missing here?