0 votes

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!!!

in Engine by (14 points)

1 Answer

+1 vote

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...
by (1,308 points)

Oh actually, in 3.2 you can set:

get_node("TouchButton").visible = false

and that will disable input as well.

Thank you this did solve my problem :)

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.