How do I "de-select" a button with right-click?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By fabzzz89

Hey guys,

I’m working on a tower def game and I’m working on my buttons here.
In my game, I have the button toggle working,it goes from on to off when you click on it or press 1.
Now, I want to be able to right click anywhere outside the button to toggle the button to “off”

I can’t seem to find a way to get _input(event) working with the button toggles. any advice?

image included

:bust_in_silhouette: Reply From: clemens.tolboom


func _input(event:InputEvent):
	if event is InputEventMouseButton:
		var e:InputEventMouseButton = event
		if e.button_mask == BUTTON_RIGHT:
			$Button.pressed = false