Hello,
I can't figure how to visually press a button in GDScript. I want my button to appear pressed, I know how to send the signal that the button has been pressed.
I don't want to use the "ui_accept" action and the button must still work with mouse clic.
Here is my code :
func _input(event):
if Input.is_action_just_pressed("up_action"):
$Node2D/Button.grab_focus()
$Node2D/Button.pressed = true
$Node2D/Button.set_pressed(true)
print($Node2D/Button.pressed)
The console only print "False" except when I press the button with a mouse clic then trigger the "upaction". The "upaction" contains the Up arrow key and the W key.
Do you know how can I visually press my button though GDScript ?
Thanks !