+1 vote

I want to be able to click a button and toggle it on and then click another button to toggle it off. But how do i set a button thats set to toggle mode back to neutral using script

in Engine by (47 points)

_button.pressed = not _button.pressed

1 Answer

+1 vote

If your scene tree looks like this:
Any node with script attached

Button1 (Toggle mode active)
Button2 (signal onButton2_pressed connected to the root node's script)

In the script:
extends Node (or whatever node your root node is/the node this script is attached to)

_on_Button2_pressed():
    $Button1.button_pressed = false
by (378 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 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.