Quick access to iOS haptics functions for Unity.
- A recent version of Unity
- An iPhone 7 or later running iOS 12 or later
Recommended Installation (Unity Package Manager)
- "Add package from git URL..."
- https://github.com/ryanslikesocool/HapticsKit.git
Alternate Installation
- Get the latest release
- Open with the desired Unity project
- Import into the Plugins folder
Import HapticsKit into a C# script with using HapticsKit;
Check if the current device supports haptics.
bool currentDeviceSupportsHaptics = HapticsController.SupportsHaptics;
Call one of the methods in HapticsController
.
These methods act as a C# wrapper around the Obj-C source.
HapticsController.NotificationFeedback(NotificationType.Success);
HapticsController.ImpactFeedback(ImpactType.Light);
HapticsController.SelectionFeedback();
//etc...
Notification and Impact feedbacks have a range of options
// Notification
NotificationType.Success
NotificationType.Warning
NotificationType.Error
//Impact
ImpactType.Light
ImpactType.Medium
ImpactType.Heavy
ImpactType.Soft
ImpactType.Rigid