Supported Platforms

iOS, Android, and safe no-op behavior in Unity Editor or unsupported platforms.

Unity Version

Recommended for Unity 2021.3 LTS or newer.

Dependencies

No third-party runtime dependencies required. Uses standard Unity UI types for no-code UI integration.

Overview

Mobile Haptics Pro is a Unity utility for adding premium-feeling mobile haptics on Android and iOS with a unified API, reusable pattern assets, no-code components, event-driven routing, and a mixer system for arbitration. It also includes editor-side preview and diagnostics tooling for testing and iteration.

The package supports one-line runtime calls, no-code UI and collision integration, animation and timeline triggering, preset libraries, custom pattern assets, event mapping profiles, mixer profiles, and dedicated editor windows for preview, mapping, and diagnostics.

If haptics are unavailable, such as in the Unity Editor, on unsupported devices, or on hardware without haptics support, playback safely no-ops instead of throwing errors.

Installation

  1. Import the Assets/MHaptics folder into your Unity project.
  2. Optionally open Project Settings > MHaptics and create a default MHapticsConfig.
  3. Build to a physical Android or iOS device for final haptics validation.

Android note

The Android vibration permission is included through Assets/MHaptics/Plugins/Android/AndroidManifest.xml.

Supported platforms

  • iOS: Core Haptics on supported iOS 13+ hardware, with UIKit feedback-generator fallback.
  • Android: Vibrator and VibrationEffect where available.
  • Unity Editor / unsupported platforms: safe no-op behavior.

Quick Start

The fastest way to start is to import the package, optionally create your config asset, then build one of the included demo scenes to a physical device for testing.

Simple example

using MHaptics;

public class Example : MonoBehaviour
{
    public void OnClick()
    {
        Haptics.SelectionChanged();
    }
}

Fastest way to test

  1. Open Tools > MHaptics > Create Demo Scenes.
  2. Use MHapticsDemo_UI.unity for UI and preset testing.
  3. Use MHapticsDemo_Physics.unity for collision and trigger testing.
  4. Run baseline tests like Core Status and Vibrate first.
Many emulators and some tablets do not expose a vibrator motor, so physical device testing is recommended for final validation.

Runtime API

Basic one-line calls

Haptics.ImpactLight();
Haptics.ImpactMedium();
Haptics.ImpactHeavy();
Haptics.SelectionChanged();
Haptics.NotificationSuccess();
Haptics.NotificationWarning();
Haptics.NotificationError();
Haptics.PulseShort();
Haptics.PulseDouble();
Haptics.PulseWarning();
Haptics.ChargeShort();
Haptics.ChargeLong();
Haptics.RumbleShort();
Haptics.RumbleHeavy();
Haptics.SelectionSoft();
Haptics.SelectionStrong();

Channel-aware playback

Haptics.Play(HapticPreset.SelectionChanged, HapticMixerChannel.UI, priority: 40, key: "MenuSelect");
Haptics.Play(myPattern, HapticMixerChannel.Gameplay, priority: 65, key: "CombatImpact");

Generic vibrate, cancel, and continuous playback

Haptics.Vibrate(60);
Haptics.Cancel();
var cancelled = Haptics.TryCancel();

var started = Haptics.TryStartContinuous();
Haptics.StopContinuous();

Capability checks and settings

var canVibrate = Haptics.CanVibrate();
var hasVibrator = Haptics.HasVibrator;
var supportsAmplitude = Haptics.SupportsAmplitudeControl;

Haptics.SetEnabled(true);
Haptics.SetIntensity(HapticIntensity.Medium);
Haptics.MinIntervalMs = 35;

Force-based impact mapping

Haptics.ImpactFromForce(hitForce);

Default mapping:

  • 0-2ImpactLight
  • 2-6ImpactMedium
  • 6+ImpactHeavy

Bind a settings toggle

using UnityEngine.UI;

public Toggle vibrationToggle;

void Start()
{
    Haptics.BindToggle(vibrationToggle);
}

No-Code Components

HapticButton

Attach to a Unity UI Button for click and optional pointer down/up haptics. Choose either preset output or pattern output, and optionally define a local cooldown.

HapticUIEvent

Attach to Button, Slider, Toggle, or Dropdown elements to trigger haptics from click, pointer, or value-changed events without writing code.

HapticCollision

Attach to colliders for collision- or trigger-driven haptics. Supports preset or pattern playback, velocity scaling, cooldowns, tag filtering, and layer filtering.

HapticTimeline

Plays haptics as part of timing-based gameplay flow. Supports optional patterns, fallback presets, start/event/animation triggers, and delay control.

HapticAnimationEvent

Lets animation clips trigger preset or pattern playback via standard Unity animation events.

HapticEventBridge

Exposes common haptics methods as UnityEvent-friendly no-argument functions, including impact, notification, pulse, charge, rumble, selection, continuous playback, cancel, enable, and intensity helpers.

Patterns & Library

HapticPattern

Create pattern assets through Assets/Create/MHaptics/Haptic Pattern.

Supported modes:

  • SinglePreset
  • PresetSequence
  • CustomSequence
  • SmoothCurve

SmoothCurve mode samples an intensity curve over time for authored ramps and continuous-feel playback. If a sequence is empty or unsupported, the fallback preset is used.

HapticPresetLibrary

HapticPresetLibrary.Play(HapticLibraryPreset.CoinPickup);
HapticPresetLibrary.Play(HapticLibraryPreset.Success);

Included preset groups:

  • Gameplay: CoinPickup, DamageTick, LevelComplete, Explosion, ComboHit, CriticalHit
  • UI: ButtonPress, MenuNavigation, ToggleChange, SliderTick
  • System: Success, Warning, Error

Event Mapping

HapticEventMappingProfile

Use mapping profiles to connect semantic gameplay events like Damage, CriticalHit, or LevelUp to a preset or pattern.

Create via:

Assets/Create/MHaptics/Haptic Event Mapping Profile

Each mapping entry can define:

  • eventId
  • source (Preset or Pattern)
  • preset
  • pattern
  • intensityMultiplier
  • optional cooldownMs
  • optional priority
  • enabled

Activate a profile

HapticEventRouter.SetActiveProfile(profile);

Trigger mapped events

HapticEventRouter.TriggerEvent(HapticGameEvents.Damage);
HapticEventRouter.TriggerEvent(HapticGameEvents.CriticalHit, 1.35f);

HapticEventRouter.TriggerEvent("BossEnraged");
HapticEventRouter.TriggerEvent("BossEnraged", 1.2f);

Custom event IDs are supported, and matching is case-insensitive.

Haptic Mixer

The mixer arbitrates simultaneous haptic requests with channels, priorities, queueing, blending, cooldowns, and continuous duck/resume behavior.

HapticMixerProfile

Create via:

Assets/Create/MHaptics/Haptic Mixer Profile

Channel rules support:

  • channel
  • cooldownMs
  • allowInterrupt
  • allowQueue
  • maxQueueDepth
  • allowBlendOnEqualPriority
  • blendWindowMs
  • duckLowerPriorityContinuous

Assign at runtime

public HapticMixerProfile combatMixer;

void EnterCombat()
{
    Haptics.SetMixerProfile(combatMixer);
}

Channel types

  • Gameplay
  • UI
  • Event
  • System
  • Continuous
There is also an editor shortcut at Tools/MHaptics/Locate or Create Mixer Config to find or create a recommended mixer profile and auto-assign it when possible.

Editor Tools

Test Window

Open Tools > MHaptics > Test Window to test presets, custom pattern assets, intensity settings, and general status in-editor.

Preview Lab

The editor preview tooling includes waveform timeline visualization, a shake mock, haptic energy meter, recent event feed, optional haptic audio proxy, and A/B comparison.

Visual Haptic Designer

Lets you visually create and edit patterns, move steps, apply templates, preview results, and configure SmoothCurve settings directly in the authoring workflow.

Event Mapping Window

A dedicated workflow for creating, loading, editing, and activating event mapping profiles.

Mixer Monitor

Open Tools > MHaptics > Haptic Mixer Monitor to inspect live mixer decisions such as Accepted, Rejected, Replaced, Queued, Blended, and Ducked.

Testing Workflow

Recommended workflow

  1. Start with HapticButton and HapticUIEvent for UI feel.
  2. Add HapticCollision for gameplay contact feedback.
  3. Use HapticTimeline and HapticAnimationEvent for timing-critical moments.
  4. Use HapticPresetLibrary for consistency.
  5. Bind player settings with Haptics.BindToggle(...).
  6. Validate final behavior on physical Android and iOS devices.

Demo scenes

Use the demo scene generator to create:

  • Assets/MHaptics/Samples/Demo/Scenes/MHapticsDemo_UI.unity
  • Assets/MHaptics/Samples/Demo/Scenes/MHapticsDemo_Physics.unity

The UI demo covers presets, advanced presets, UI components, timeline, animation-event bridge, event mapping triggers, and mixer diagnostics. The physics demo focuses on collision and trigger behavior.

Project Settings

Open Project Settings > MHaptics to configure default runtime behavior.

General

  • enabledByDefault
  • debugLogging
  • minimumIntervalMs
  • defaultIntensity

Android

Includes separate impact duration, selection duration, amplitude, and notification waveform settings.

iOS

Includes Core Haptics enablement, UIKit fallback behavior, generator preparation options, continuous playback tuning, and intensity/sharpness profiles for runtime intensity modes.

Editor

editorPlayModeUseAudioProxy enables the haptic audio proxy in Play Mode even when no tool window is open.

Mixer

Assign an optional mixerProfile to control runtime arbitration.

Troubleshooting

No vibration on Android

  1. Confirm device-level vibration or haptics settings are enabled.
  2. Test on physical phone hardware.
  3. Run the demo Vibrate test action.
  4. Check logs for [MHaptics] warnings.

Nothing happens in the Unity Editor

Hardware haptics in the editor are expected to be safe simulation or no-op. Use the Test Window and Preview Lab to evaluate timing and intensity intent, then validate final feel on physical devices.

Too many haptics fire

  • Increase Haptics.MinIntervalMs.
  • Use local cooldowns on the individual components.

Additional Documentation

Useful package documentation locations:

  • Assets/MHaptics/Documentation/README.md
  • Assets/MHaptics/Documentation/TESTING_GUIDE.md
  • Assets/MHaptics/Samples/Demo/README.md
For onboarding non-programmers, start with the demo scene and no-code components first, then introduce the runtime API, event mapping, and mixer features afterward.