Unity Swipe Input
A downloadable code asset
About
Why did I create this thing?
In general, initially the swipe recognition system was not conceived as a separate asset. I needed it for the implementation of a project that never saw the light. But after a few months, I thought about it and decided that such an asset can be useful to many, especially beginners. All interaction with it is based on events and this ensures convenient use in any project. ((Examples of use can be found in the documentation.)
Package types
- GoTo-Apps.SwipeDetector v.1.1 [ALPHA] (Education):
The most complete version. With documentation and usage examples. Ideal for the first acquaintance with the package.
- GoTo-Apps.SwipeDetector v.1.1 [ALPHA] (Production):
The version of the package without usage examples.
Documentation
Description of components, events, methods, and properties that are present in the asset.
Settings
- Swipe Detection Mode (DetectionMode) - Swipe detection mode. Completed swipe or uncompleted swipe.
- Min Swipe Distance (float) - Minimum swipe length. If the swipe length is less than the specified one, the swipe will not be recognized.
- Is Paused (bool) - Pause. If the value is `true`, the component does not process swipes and does not raise events.
Events
- Swipe Start (UnityEvent<Vector2>) - An event that is triggered when the user touches the screen. The touch position is passed as a parameter.
- Swipe End (UnityEvent<Vector2>) - An event that is triggered when the user releases the screen. The position at which the user released his finger is passed as a parameter.
- Swipe Up (UnityEvent) - An event that is triggered when a player makes an up swipe.
- Swipe Right (UnityEvent) - The event that is triggered when the player makes a swipe to the right.
- Swipe Down (UnityEvent) - The event that is triggered when the player makes a swipe down.
- Swipe Left (UnityEvent) - The event that is triggered when the player makes a swipe to the left.
Methods
- SwipeInput.SetPause() - Sets the pause.
- SwipeInput.UnsetPause() - Removes the pause.
Examples
3 steps to easy use.
1) - Create event handler.
First, you need to decide what you want to do with swipes. You need to create a swipe event handler.
2) - Add a handler to the event.
Then you need to select the appropriate event and add a handler to it. For example, I want my handler to run when swiping to the left.
3) - Enjoy the result.
That's it, let's go make coffee and rejoice at how cool we are :)
Support
You can help me make the world a better place.
You can use my products absolutely free of charge for any purpose, including commercial. But if my product makes your work easier, then you can thank me by paying the amount that you consider necessary for this asset. Or you can subscribe to me on Patreon using the button below.:)
Status | Released |
Category | Assets |
Publisher | |
Release date | Jul 23, 2021 |
Author | n.fridman |
Made with | Unity |
Tags | asset, code, swipe, Unity |
Code license | MIT License |
Asset license | Creative Commons Attribution v4.0 International |
Average session | A few seconds |
Languages | English |
Inputs | Touchscreen, Smartphone |
Accessibility | Configurable controls |
Links | Source code, Patreon, YouTube |
Download
Click download now to get access to the following files:
Development log
- Swipe Input v.1.0.3 UpdatesAug 12, 2022
- Swipe Input v.1.0.1 UpdatesJul 23, 2021
Leave a comment
Log in with itch.io to leave a comment.