How do I apply a touch swipe code to be effective on all the screen?

Hello,

I am new to unity and to these forums so please excuse any wrong term. I am creating a simple 2D app that is sort of a children story book. Simple animations and simple functionality.

I was able to get a script that check the touch start and end positions etc… Meaning i have the functionality of detecting the swipe and speed and whether the user actually swiped or not.

My question is where do I add this handler script to be effective on the whole Camera (The User’s screen). I need to detect when the user swipes regardless of where. I am not sure where I should be adding it. Any help is appreciated. Thanks.

Hard to tell what you’ve got already, without any code.

You might want to write a coroutine that continuously checks for swipes. Or, check for swipes in the Update() event of one of your components.

For some ideas, see: Touch screen horizontal or vertical swipe - Unity Answers