54 Unity Swipe & Drag Mechanic Tutorial | Mobile Trail Renderer Cutting Game

Опубликовано: 23 Март 2026
на канале: Sudheendra S G
25
0

00:00 Intro: Swipe/Drag mechanic overview (mobile gameplay)
00:57 Create/Open project + download package (Patreon)
01:53 Clean up project (remove readme + input asset)
02:10 Load Sartvic layout + import Unity package
02:50 Open scene + fix Game view resolution
03:21 Create Target layer + assign to GameManager & prefabs
03:56 Create ClickandSwipe script (Trail + Collider + Rigidbody)
05:00 Add [RequireComponent] + declare component refs
07:03 Awake setup (trigger, kinematic RB, disable trail/collider)
09:23 Create methods: BeginSwipe / EndSwipe / SetWorldPosition
11:50 OnTriggerEnter → call Targets.OnHit (using ??)
15:27 Update GameManager: add swipe refs + swipeZ + isSwiping
18:11 HandleSwipe + UpdateSwipePosition (Input System)
26:43 Create Swipe Object in scene + add ClickandSwipe component
27:22 TrailRenderer settings (width, color, material, time)
28:33 BoxCollider + Rigidbody settings (trigger, kinematic, no gravity)
29:12 Link Swipe Object in GameManager inspector
29:41 Test issue: swipe on wrong Z plane (scene view check)
30:03 Fix swipeZ and retest (swipe destroys objects)
30:53 Build WebGL + PWA settings (resolution, compression off)
32:01 Fix build error (remove using Mono.Cecil)
32:39 Zip build + upload to Unity Play + publish

Get free resources for this course from the below patreon link

  / 145923169  

Finished Games can be tested with the link below

https://play.unity.com/en/user/414168...

In this Session 54 of the Junior Programmer Series, we upgrade our Clicky Crits game for mobile-style gameplay by adding a Swipe / Drag to Destroy mechanic.

Instead of tapping targets, the player can press, drag, and swipe across the screen to destroy objects. We’ll build a complete swipe system using Unity features like Trail Renderer, Box Collider + Rigidbody (Trigger), and the New Input System (Pointer Press + Position). By the end, you’ll have a satisfying blue swipe trail that follows your finger/mouse and destroys targets on contact.

✅ What you’ll learn in this video:

How to create a Swipe Object that follows pointer movement

How to use Trail Renderer for a clean swipe trail effect

How to configure 3D Trigger Collisions (BoxCollider + Rigidbody) correctly

How to call Targets.OnHit() when swipe touches targets

How to handle swipe start/end + continuous movement using the New Input System

How to fix swipe depth using swipeZ in an Orthographic camera setup

How to build and upload the game to Unity Play (WebGL / PWA)

📌 Project Setup Notes:

Template: URP Universal 3D

Camera: Orthographic (mobile-friendly)

Targets use 3D BoxCollider, swipe uses Trigger collisions

Make sure to create the Target layer after importing the package

🎮 Build & Share:
We also build the project for WebGL, zip it, and upload it to Unity Play so you can share the playable link.

If you found this helpful, like, subscribe, and continue to the next session where we’ll debug an already created game.

#Unity #UnityTutorial #GameDev #MobileGame #SwipeMechanic #TrailRenderer #NewInputSystem #URP #WebGL #UnityPlay