Gesture Combo | ManukoTech
GestureCombo Icon

Gesture Combo

1. Introduction

Welcome to the GestureComboTouch solution. This asset provides a powerful and modular approach to implementing both simple and advanced touch and gesture controls in Unity. Easily integrate taps, swipes, holds, and multi-touch gestures like pinch and rotate to enhance your game's interactivity.

2. Installation and Basic Requirements

  1. Activate Unity Input System
  2. EventSystem
    • Ensure an EventSystem is present in your scene (Hierarchy). If missing, add one via Create → UI → Event System.
  3. Import Asset
    • Import all scripts from the Mobile Touch & Gesture Add-On for Unity's New Input System assets using the Package Manager in My Assets.

3. GestureComboManager: Define Gesture Sequences

Use the GestureComboManager to create complex gesture sequences (combos). A combo consists of multiple steps (e.g., "Tap" → "SwipeLeft" → "Tap"). When the sequence is performed correctly, the associated action is triggered.

Use the prefabs out of the Prefab folder or build your own.

3.1. Create Manager Object

Create an empty GameObject in your scene (e.g., "GestureComboManager") and add the GestureComboManager script to the GameObject.

3.2. Combo Manager Settings

Screenshot: Gesture Combo Settings
Option Description
Debug Enabled When enabled, the manager logs recognized gestures and combo steps to the Unity Console. This is useful while setting up and testing combos but should normally be disabled in production.
Allow Combo Abort Allows the current combo sequence to be cancelled when the next gesture does not match. The manager resets the progress so a new combo can start immediately.
Abort Executes Last Step If enabled, the last successfully recognized step of the combo is still executed when the combo is aborted. This is useful when you want partial actions for incomplete combos (for example: simple attack instead of full combo).
Use API Enables the event-based API for this manager. When active, each executed step is reported to the GestureComboManager API (for example for custom code, analytics or syncing with other systems).
Identifier A unique identifier for this manager instance. It is used to link Touch and Multi-Touch input components and to distinguish managers in the API. Make sure the identifier matches the one used in the corresponding input components.
Gesture Combos The list of all combos managed by this GestureComboManager. Each entry represents one combo with its own step list and settings. Use the Add New Combo button to create additional combos.

3.3. Defining Combos

Screenshot: Combo List and Steps

Each combo consists of one or more steps. The order and timing of these steps are used to detect a valid combo. In the Gesture Combos section you can create and edit all combos handled by this manager.

Field Description
Name The display name of the combo. It is shown in the inspector and in debug logs. Use clear names like Jump, Sprint + Jump or Open Menu.
Steps The list of gesture steps that define this combo. Each step references a gesture recognition (for example Tap, Swipe, Hold). You can add a single step (for a one-gesture action) or multiple steps (for a full combo sequence). Use the + button to add a step and the - button to remove the selected step.
Add New Combo Creates a new empty combo at the bottom of the list. After creating it, set a Name and add one or more Steps to define how this combo should be recognized.

3.4. Combo Step Details

Screenshot: Combo Step Settings

Each entry in the Steps list represents one gesture step of the combo. The manager processes these steps in order. A step defines which gesture must be performed and which actions are executed when the step is recognized.

Field Description
Step Name Display name of the step. It appears in the inspector and in debug logs. Use a clear name such as Jump or Open Menu.
Gesture The gesture that must be recognized for this step (for example Tap, Swipe Up, Hold). The combo progresses to the next step only if this gesture matches.
Using Unity Event Enables the UnityEvent section for this step. When the step is recognized, all configured UnityEvent callbacks are invoked. This allows reactions without custom scripting.
Using Input System Enables the Input System section for this step. When active, the step drives an Input System action via the selected Control Path and Action Mode.
Event (Perform Action – Unity Event) The UnityEvent that is invoked when this step is successfully recognized. You can add one or more listeners and hook them up to methods in your scene objects.
Action Mode (Perform Action – Input System) Defines how the linked Input System control is triggered. Typical modes are Trigger (single pulse), Toggle (switch between on and off), or one-directional toggle modes (only on or only off), depending on your setup.
Control Path Input System control path that is driven by this step (for example a button on a virtual gamepad action). Use the picker button to select a binding from your Input Actions asset.
Duration Defines how long the system waits after this gesture is recognized before the step is executed if no additional combo gesture is detected.

Example: If set to 1.0, the manager waits for 1 second to see if the next combo step occurs. If no matching step happens within that time window, this step will automatically execute.
Always Active When enabled, this step is executed immediately as soon as its gesture is recognized, regardless of whether the combo expects additional steps afterwards.

The combo sequence continues normally. This is useful when the step should always trigger instantly (for example, an immediate effect) even if more steps follow in the combo.

Special Handling for Hold Gestures

Screenshot: Hold Gesture Step Settings

When the selected Gesture is Hold, additional timing and Input System options appear. These settings define how long the gesture must be held and which Input System actions should be triggered when the hold begins and ends.

Field Description
Hold Time Defines the maximum time window within which the next combo gesture must occur after the hold begins. If the next gesture does not happen before this time expires, this step is executed automatically.
Hold Start (Input System) Defines what should happen when the hold begins. Choose an Action Mode (for example Toggle On) and select a Control Path from your Input Actions asset.
Hold End (Input System) Defines what happens after the hold ends (finger lifted). Usually paired with the Hold Start configuration, for example: Toggle On when the hold begins, and Toggle Off when the hold ends.
Duration How long the triggered Input System action stays active after Hold End. Setting it to 0 creates an instant pulse. Can be combined with Always Active.
Always Active Forces the Input System action to remain active regardless of the Duration field. Ideal for continuous behaviors such as sprinting.

4. Touch Input Setup

Screenshot: Touch Gesture Input

The Touch Gesture Input component detects single-finger gestures such as taps, swipes, and holds. It forwards the recognized gestures to one or more GestureComboManager instances for further combo processing.

Field Description
Touch Identifier A unique identifier for this input component. This identifier is used by combo managers to know which touch source events come from.
Gesture Managers A list of GestureComboManager components that receive gesture events from this input source.

You can add multiple managers and switch between them at runtime (e.g. gameplay → UI → inventory).
Tap Max Time Maximum time window (in seconds) in which a touch can be recognized as a tap. If the finger stays down longer, it will no longer be considered a tap.
Hold Time Minimum time (in seconds) the finger must stay on the screen before a hold is recognized.
Swipe Threshold Minimum finger movement (in pixels) required to detect a swipe.
Max Tap Movement The maximum allowed movement for the touch to still count as a tap. If movement exceeds this value, a tap will not be detected.
Touch Area Optional RectTransform restricting where touch input is accepted. Useful for UI-based gesture regions (e.g. only left half of screen).
Ignore UI Element When enabled, touch input is ignored whenever the finger is over a UI element.
Debug Enabled Logs detected gesture events (tap, swipe, hold) to the console for debugging.
Use API Enables event-based API output for this input source. Useful for analytics or custom C# logic reacting to raw gesture events.

Gesture Types Detected

  • Tap: A quick touch with minimal movement and within Tap Max Time.
  • Hold: Finger remains down for at least Hold Time.
  • Swipe: Detected once movement exceeds Swipe Threshold (supports Up, Down, Left, Right).

Hold Gesture Flow

When a hold gesture is detected, two phases are recognized:

  • Hold Start: Triggered when Hold Time is reached.
  • Hold End: Triggered when the finger is released after a hold.

Both phases can be used inside combo steps or consumed via the API.

Switching Gesture Managers at Runtime

You can switch which GestureComboManager is currently active by calling:

touchInput.SwitchGestureManager(targetIndex);

This is especially useful for switching between gameplay controls, UI controls, or menus.

Screenshot: Switching Gesture Manager via UnityEvent

You can also trigger this through Unity Events:

  1. Add a UnityEvent under a combo step or an action.
  2. Select TouchGestureInput → SwitchGestureManager(int).
  3. Set the target index.

5. Multi-Touch Setup

Screenshot: Multi-Touch Gesture Input

The MultiTouch Gesture Input component detects two-finger gestures such as pinch (zoom) and rotation. It forwards the recognized gestures to one or more GestureComboManager instances so they can be used inside gesture combos or via the API.

Field Description
Multitouch Identifier Unique identifier for this multi-touch input source. It is used to distinguish this component from other touch or multi-touch inputs.
Gesture Managers List of GestureComboManager components that receive the pinch and rotation events from this multi-touch input. You can assign multiple managers and switch between them at runtime.
Touch Area Optional RectTransform that limits where multi-touch input is read. Only touches inside this rectangle are processed (useful for UI-based touch regions).
Ignore UI Element When enabled, touches that start over UI elements are ignored for multi-touch gestures.
Output Rotation To API Sends the current rotation value to the API callback whenever a rotation gesture is active. Enables custom scripts or analytics to read rotation data directly.
Output Pinch To API Sends the current pinch (zoom) value to the API callback while a pinch gesture is active.
Zoom Speed Sensitivity for pinch zoom. Higher values make zoom in / out react faster to the same finger movement.
Rotation Speed Sensitivity for rotation. Higher values turn the output faster for the same finger rotation.
Rotation Bias Factor Factor used to smooth or damp small rotation changes before they are treated as real rotation input. Larger values reduce small jitter in the gesture.
Base Rotation Threshold Minimal rotation angle (in degrees) that must be exceeded before a rotation gesture is considered active.
Rotation Activation Threshold Additional threshold that must be passed to fully activate rotation. Use this to fine-tune when rotation should start affecting your game or UI.
Pinch Threshold Minimal distance change between the two fingers (in pixels) before a pinch gesture is recognized as valid zoom input.
Pinch Activation Threshold Extra threshold used to decide when the pinch value should start affecting your camera or UI. Helps to ignore very small accidental zooms.
Debug Enabled Logs multi-touch events (rotation, pinch and internal values) to the console for debugging.
Last API Rotation Value / Last API Zoom Value Read-only values that display the most recent rotation and zoom values sent to the API. Useful for debugging and tuning thresholds.

Detected Gestures

  • Rotation Left / Right: Two-finger rotation above the configured rotation thresholds.
  • Pinch In / Out: Two-finger pinch that moves closer together or further apart beyond the pinch thresholds.

Switching Gesture Managers at Runtime

You can change which GestureComboManager receives the multi-touch events by calling:

multiTouchInput.SwitchGestureManager(targetIndex);

This is useful, for example, when switching between gameplay, map view or menu controls.

Screenshot: Switching Multi-Touch Gesture Manager via UnityEvent

You can also trigger this via Unity Events:

  1. Add a UnityEvent (for example on a combo step or UI button).
  2. Assign MultiTouchGestureInput → SwitchGestureManager(int).
  3. Set the desired manager index as parameter.