This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Basically I just want to filter my inputs so that only InputEventScreenTouch gets through. However, it seems that all the inputs I do gets filtered. See my code below.
Output shows both INPUT OK and INPUT HELD but the underlying button never gets clicked unless I take off the setinputas_handled() line, what am I doing wrong here?

func _input(event):
controlHold = true
if event is InputEventScreenTouch:
    #other more complex IF conditions here
    controlHold = false
    print('input OK')
if controlHold:
    get_tree().set_input_as_handled()
    print('input held')
in Engine by (45 points)

2 Answers

0 votes

I think its event of type InputEventMouseButton that is screwing my code logic. It gets triggered right after the InputEventScreenTouch events and thus setting flagging the input as handled.

by (45 points)
0 votes

In project settings General tab, under Display then Window, there are a couple checkboxes under Handheld. One is “Emulate Mouse From Touch.” If this is checked, try unchecking it. I haven’t tested this, but it seems like a logical solution.

by (78 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 Frequently asked questions and 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 [email protected] with your username.