How to handle specific input types only

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

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 set_input_as_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')
:bust_in_silhouette: Reply From: Allan

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.

:bust_in_silhouette: Reply From: Jams

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.