Skip to main content
‹ Back to Tutorials
Intermediate Unity

Remake Roller Splat with Unity 3D and Playmaker - Adding Swipe Gesture Action and Test on Phone

Feb 6, 2021
About this tutorial

In this Unity and Playmaker tutorial series I'll recreate Roller Splat. PART 2 - I've set up movement now in this tutorial I'll add the Swipe Gesture Action - SUPER EASY. Absolutely NOCODE. Also check out How to Make a Bounce Game Series https://bit.ly/39HIYBU. 👉🏼 To Sign up for email updates o

Written Guide

The previous tutorial in this Roller Splat–style series built the movement structure but drove it with Get Key Down actions, which is fine on a desktop and useless on a phone. This entry swaps in real swipe gestures — and because the movement system was built around events rather than input checks, the change takes one action.

Step 1 — Set up Unity Remote for on-device testing You can't meaningfully test swipe input with a mouse. Install Unity Remote 5 on your phone (it's available for both iOS and Android), connect the device to your computer with a cable, then go to Edit, Project Settings, Editor and select your device under Unity Remote Device. Now when you press play in the editor, touches on the phone drive the game. Worth setting expectations: the streamed game view is not one-to-one and the app is showing its age, but it remains the fastest way to test touch events without doing a full build.

Step 2 — Understand why this swap is easy Open the movement control FSM in your managers object. The existing structure already detects input and fires four separate events — swipe up, swipe down, swipe left, and swipe right — with Get Key Down actions triggering them from the arrow keys. That indirection is the whole trick. Because nothing downstream cares how the swipe-left event got fired, adding a second input source means adding a new action that fires the same events.

Step 3 — Add the Swipe Gesture Event action In the action browser, search for "swipe" and add Swipe Gesture Event to the same state that holds your key-down actions. The action exposes fields for swipe left, right, up, and down, so you can point each one directly at the event you already created. Wire swipe left to your swipe left event, swipe right to swipe right, and so on for all four.

Step 4 — Keep both input methods live Note what you now have: keyboard input and touch input coexisting in the same detection state, both firing the same events. Don't delete the Get Key Down actions. Keeping them means you can keep iterating in the editor with arrow keys and only reach for the phone when you specifically want to verify touch behavior.

Step 5 — Tune the minimum swipe distance The Min Swipe Distance field sets how far the player's finger has to travel before the gesture registers. This value is normalized against screen width, so the full width of the screen equals 1. That means 0.2 requires a swipe across a fifth of the screen. Don't set it too high — a large value forces exaggerated gestures and makes the game feel unresponsive — and don't set it near zero, or incidental taps and small drags will register as swipes. Start at 0.2 and adjust from there.

Step 6 — Test on the device With the phone connected, press play and try all four directions. In a Roller Splat–style layout the walls constrain which moves are legal at any given moment, so plan your test path around the level geometry rather than assuming a failed swipe means broken input. Each successful swipe should fire its event, which in turn translates the ball and casts a ray in the direction of travel so the ball knows when it has hit something and should stop.

That's the complete touch input layer. The next tutorial moves on to building the first real level.

Unity tools by Bliz Studio
Built for our own games — now on the Asset Store

Multi Tag — unlimited hierarchical tags for any GameObject. Hierarchy Pro — style your whole hierarchy with rules. Made by a Unity dev, for Unity devs.

Explore our Unity assets →