Ignore mouse on TouchScreenButton

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By fagju
:warning: Old Version Published before Godot 3 was released.

Hi!
Please can anyone explain how to ignore or to stop touch on a touch screen button. There is a moment when I want my touch screen button to be disabled from any input event.
Thank you!!!

:bust_in_silhouette: Reply From: ericdl

2 options come to mind:

Use set_block_signals() to block the button press signal:

get_node("TouchButton").set_block_signals(true)

Use return in the button’s signal connection:

var PauseButton = false

func _on_TouchButton_pressed():
	if PauseButton = true:
		return
	if PauseButton = false:
		do stuff...

Oh actually, in 3.2 you can set:

get_node("TouchButton").visible = false

and that will disable input as well.

hidemat | 2020-04-06 16:31

Thank you this did solve my problem :slight_smile:

morningkingdom | 2021-09-18 16:50