Unity Touch & Mobile Scripts

12 free C# scripts 6 beginner6 intermediate Unity 2022.3+ MIT licensed

Mobile games need input and layout work that desktop projects never see. This category has the input side, with swipe, tap and long-press detection, a virtual joystick, touch buttons, pinch-to-zoom and gyroscope camera control, and the layout side, with a safe-area handler for notched phones and a UI scaler for different aspect ratios.

It also includes the core loops of common hyper-casual and idle games: an endless runner controller with lanes, a tap-to-stack mechanic, a score manager with combos and saved high scores, and an idle income generator with offline earnings.

Start with Swipe Input Controller

Detects touch swipes in four directions with configurable thresholds and dead zones. Fires UnityEvents for each swipe direction with speed and distance tracking.

SwipeInputController.cs · 9 Inspector fields · beginner

Open Swipe Input Controller
SwipeInputController.cs
Script SwipeInputController
Swipe Settings
Min Swipe Distance 50
Max Swipe Time 0.5
Dead Zone 20
Events
On Swipe Up ()
List is Empty
On Swipe Down ()
List is Empty
On Swipe Left ()
List is Empty
On Swipe Right ()
List is Empty
On Swipe Start (Vector2)
List is Empty
On Swipe End (Vector2, float, float)
List is Empty

All 12 touch & mobile scripts

What these scripts need

Read from each script's source, so this list stays in step with the code.

Kits that build on them

Guides that use them