Swipe Input View on Asset Store (opens in new tab)

Package details

Latest version
1.0
Last updated
First released
Unity version
2022.3.5 or later
Package size
35 KB
Files
5
Favorites
21
Views in the past week
6

Price tracking

Last checked
Tracked since
Lowest recorded
Free on

Keywords

Swipe Input

by codemaker2015 (opens in new tab)

1 rating, too few to average

This package allows users to perform various actions by swiping in different directions - up, down, left, and right.

Price Free

Get it free on Asset Store (opens in new tab)

Affiliate link · Purchases support this site

Price history

Last 6 months

USD
Price history for Swipe Input, 6 months Current Free; lowest Free; highest Free in this period. $0 Jun Jul Aug Sep Oct Nov

Asset preview

1 / 2

Swipe Input screenshot 1

Swipe Input screenshot 1

About this asset

Swipe Input is a powerful gesture-based interaction system designed to enhance user experience in mobile applications and games. With its two core scripts, SwipeInput and SwipeInputController, developers can effortlessly integrate tap and swipe gestures into their projects, adding intuitive controls and dynamic interactions.

Core Features:

  • Tap and swipe gesture detection for seamless user interaction.
  • Customizable offset parameters for precise gesture recognition.
  • Easy integration into Unity projects with clear documentation and usage instructions.
  • Flexibility to enable or disable tap and swipe gestures as needed.
  • Real-time debugging capabilities for monitoring gesture detection and processing.

From the publisher's Asset Store listing.

Technical details

The system consists of two scripts: SwipeInput (the core module) and SwipeInputController(the usage script).

SwipeInput Script

Core Variables

- tapPositions: An array of Vector2 to store the positions of two consecutive taps.

- swipePositions: An array of Vector2 to store the positions of two consecutive swipes.

- offsetTap: A float representing the allowed offset for a tap gesture.

- offsetSwipe: A float representing the allowed offset for a swipe gesture.

- fTapAllowed: A boolean flag indicating whether tap gestures are allowed.

- fSwipeAllowed: A boolean flag indicating whether swipe gestures are allowed.

- tempX and tempY: Temporary variables to store the differences in x and y coordinates during gesture processing.

Core Methods

- ProcessTouches(): Handles the touch input and updates the tap and swipe positions based on touch phases.

- ResetPositions(): Resets tap and swipe positions and flags.

Control Methods

- Tap(): Detects tap gestures by comparing the distance between two tap positions with the specified offset.

- SwipeLeft(), SwipeRight(), SwipeUp(), SwipeDown(): Detects swipe gestures in the respective directions by comparing the distance between two swipe positions with the specified offset.

SwipeInputController Script

Variables

- Debug: A reference to a Text component for displaying debug information.

Methods

- Start(): Initializes the Debug variable by finding the Text component.

- Update(): Processes touch input using SwipeInput.ProcessTouches() and performs actions based on detected gestures. Updates the object's position accordingly.

Usage

1. Attach the SwipeInputController script to the GameObject you want to control with swipe gestures.

2. Create a UI Text object named "Debug" to display debug information.

3. The system automatically detects swipe gestures and updates the object's position based on the detected gesture.