+2 votes

I have a button with Toggle Mode enabled:

func _on_toggle_button_down() -> void:

func _on_toggle_button_up() -> void:

When I click and release the mouse on the button, both hello and goodbye gets printed.

What I want is to print hello when the button is clicked (toggled), and print goodbuy when the button is untoggled

There is a "toggled" signal available however, it doesnt diffirentiate if its toggled ON or OFF .

Is this a bug, or am I doing something wrong?

in Engine by (28 points)

1 Answer

+4 votes
Best answer
func _on_Button_toggled(button_pressed):

The signal toggled has a bool parameter that can be used (button_pressed)
This is the behavior you expect?

by (2,096 points)
selected by

I understand now. Thank you!

It solved the problem for me, thanks!

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 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 webmaster@godotengine.org with your username.