0 votes

I have a project that I need to check for SCREEN_TOUCH or DRAG state outside of the _input() function. Can't find a way to do it. Any help is appreciated.

asked Jan 11 in Engine by D (66 points)

1 Answer

0 votes

I never used the SCREEN_TOUCH stuff, but why don't you create a variable to store that event?
Just create a member variable, and set it up inside the _input function, then use it wherever you want!

For example:

var touchEvent
func _input(event):
    if(event.type == InputEvent.SCREEN_TOUCH):
        touchEvent = event

func anotherFunc():
answered Jan 12 by bruteforce (407 points)
edited Jan 12 by bruteforce
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.