Documentation
Mobile Haptics Pro
Setup, runtime usage, no-code components, pattern authoring, event mapping, mixer configuration, editor tools, testing, and troubleshooting.
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.
Installation
- Import the
Assets/MHapticsfolder into your Unity project. - Optionally open Project Settings > MHaptics and create a default
MHapticsConfig. - 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
- Open Tools > MHaptics > Create Demo Scenes.
- Use
MHapticsDemo_UI.unityfor UI and preset testing. - Use
MHapticsDemo_Physics.unityfor collision and trigger testing. - Run baseline tests like Core Status and Vibrate first.
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-2→ImpactLight2-6→ImpactMedium6+→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:
eventIdsource(Preset or Pattern)presetpatternintensityMultiplier- 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:
channelcooldownMsallowInterruptallowQueuemaxQueueDepthallowBlendOnEqualPriorityblendWindowMsduckLowerPriorityContinuous
Assign at runtime
public HapticMixerProfile combatMixer;
void EnterCombat()
{
Haptics.SetMixerProfile(combatMixer);
}
Channel types
- Gameplay
- UI
- Event
- System
- Continuous
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
- Start with
HapticButtonandHapticUIEventfor UI feel. - Add
HapticCollisionfor gameplay contact feedback. - Use
HapticTimelineandHapticAnimationEventfor timing-critical moments. - Use
HapticPresetLibraryfor consistency. - Bind player settings with
Haptics.BindToggle(...). - 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.unityAssets/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
enabledByDefaultdebugLoggingminimumIntervalMsdefaultIntensity
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
- Confirm device-level vibration or haptics settings are enabled.
- Test on physical phone hardware.
- Run the demo Vibrate test action.
- 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.mdAssets/MHaptics/Documentation/TESTING_GUIDE.mdAssets/MHaptics/Samples/Demo/README.md