📘 Read this document in other languages:
MobileHapticFeedback is a cross-platform haptic feedback library for Unity,
providing a unified API for iOS (Core Haptics / UIKit) and Android (VibrationEffect).
It allows you to use UIKit-style feedback, parameterized one-shot impacts, and waveform-based haptic patterns with a consistent programming model across platforms.
- iOS
- Core Haptics–based impacts (CHHapticEngine)
- UIKit-style feedback (Impact / Selection / Notification)
- Android
- VibrationEffect-based haptics (API 26+)
- Unity
- Unified cross-platform API
- Safe no-op behavior when haptics are unavailable or muted
⚠️ Note (Android)
UIKit-style feedback and Core Haptics–like APIs are conceptually mapped to
the closest available vibration patterns supported by the platform.
- iOS 13+
- Android API 26+
- Unity 6000.0 or later
Add via Git URL:
https://github.com/tsyk5/MobileHapticFeedback.git?path=package/com.tsyk5.mobilehapticfeedback
To install a specific version, append a tag:
https://github.com/tsyk5/MobileHapticFeedback.git?path=package/com.tsyk5.mobilehapticfeedback#v0.2.0
MobileHapticFeedback.PlayImpact(ImpactStyle.Medium);
MobileHapticFeedback.PlaySelection();
MobileHapticFeedback.PlayNotification(NotificationType.Success);These calls are safe to use without checking availability.
If haptics are unsupported or muted by OS/user settings, calls may simply do nothing.
MobileHapticFeedback.Prepare();
MobileHapticFeedback.PlayImpact(intensity: 0.6f, sharpness: 0.3f, durationSec: 0.2);
MobileHapticFeedback.Stop();Parameters
intensity(0..1): Strength of the haptic.sharpness(0..1): Crispness / sharp edge of the haptic (iOS only).durationSec(sec): Duration of the haptic.
⚠️ Note (Android):
Android does not support the sharpness parameter.
Changing this value does not affect vibration behavior.
MobileHapticFeedback.Prepare();
var durationsSec = new float[]
{
0.6f, 0.15f
};
var amplitudes = new float[]
{
0.1f, 0f
}
MobileHapticFeedback.PlayPattern(durationsSec,amplitudes);Parameters
- durations (sec): Duration of each segment.
- amplitudes (0..1):
0means silence.1means maximum strength.
The following patterns are available in the Sample01 scene.
After building the Sample01 scene, press the buttons in each section to test and experience the haptic feedback behavior on a real device.
⚠️
Haptics cannot be reproduced in the Unity Editor.Please run the sample on a physical device.
This section demonstrates a single, parameterized haptic impact.
Adjust the sliders and press “Play Impact” to trigger the haptic.
Press “Stop” at any time to interrupt playback, even during the duration.
Construct custom haptic patterns by combining explicit duration (time) and amplitude (strength) values.
All patterns can be interrupted at any time by pressing “Stop”.
Represents the Morse code SOS (… --- …) using haptics.
Short and long pulses are combined to form a clear emergency signal.
A rhythmic pattern inspired by a human heartbeat.
Double pulses and pauses create a natural, biological rhythm.
A pattern where haptic intensity gradually increases over time.
Useful for expressing buildup, progress, or emphasis.
UIKit-style haptics follow Apple’s system-defined haptic behaviors.
These APIs provide standardized feedback patterns for common UI interactions, ensuring consistency across iOS applications.
For detailed design intent and official diagrams, please refer to Apple’s Human Interface Guidelines:
Apple – Human Interface Guidelines / Playing HapticsMIT





