If you want to move your player by swiping the screen in Unity, this tutorial is for you. This tutorial is primarily for endless runner movement, so it will be perfect if you have an endless runner game in Unity.
I have configured my player to be moved by arrow keys. But if you want to play this game on a touchscreen device, you will most likely want to add swipe controls to your player, because they are very practical if you don’t want on screen controls.
The best way to do is to disable your first script for player movement and add a new C# script. The next thing you should do is to open your InputActions asset and add a new action. Name it Swipe and set its control type to any value. Now you have to add a binding that will be set to Delta [Pointer] because when you touch the screen, Unity registers your touch as a pointer. The movement of your finger is a delta movement, like moving your mouse on the screen.
This tutorial can be implemented into your project very easily and of course, you can play it on your phone. All you need is just a mobile phone that will be used to test how the swipe movement feels like.
Join this channel to get access to perks:
https://www.youtube.com/channel/UCpRDmxAiW_6bcAUyA9-exNQ/join
Support the Creator of Kozmobot on the social networks!
CHECK OUT MY WEBSITE: http://kozmobot.com
INSTAGRAM: https://www.instagram.com/kozmobot.channel
TIKTOK: https://www.tiktok.com/@kozmobot.channel
Voir sur youtube