This class will allow you to trigger vibrations and haptic feedbacks on both iOS and Android, or on each specific platform independently.
More...
|
static void | SetHapticsActive (bool status) |
| Enables or disables all haptics called via this class More...
|
|
static bool | HapticsSupported () |
| Returns true if haptics are supported on this device More...
|
|
static void | SetDebugMode (bool log) |
| Enables or disables console logs (off by default) More...
|
|
static bool | Android () |
| Returns true if the current platform is Android, false otherwise. More...
|
|
static bool | iOS () |
| Returns true if the current platform is iOS, false otherwise More...
|
|
static void | Vibrate () |
| Triggers a simple vibration More...
|
|
static void | Haptic (HapticTypes type, bool defaultToRegularVibrate=false, bool alsoRumble=false, MonoBehaviour coroutineSupport=null, int controllerID=-1) |
| Triggers a haptic feedback of the specified type More...
|
|
static void | TransientHaptic (float intensity, float sharpness, bool alsoRumble=false, MonoBehaviour coroutineSupport=null, int controllerID=-1) |
| Plays a transient haptic, a single, short haptic feedback, of the specified intensity and sharpness More...
|
|
static void | TransientHaptic (bool vibrateiOS, float iOSIntensity, float iOSSharpness, bool vibrateAndroid, float androidIntensity=1f, float androidSharpness=1f, bool vibrateAndroidIfNoSupport=false, bool rumble=true, float rumbleLowFrequency=1f, float rumbleHighFrequency=1f, int controllerID=-1, MonoBehaviour coroutineSupport=null, bool threaded=true) |
| Plays a transient haptic, signature with more fine control More...
|
|
static void | ContinuousHaptic (float intensity, float sharpness, float duration, HapticTypes fallbackOldiOS=HapticTypes.None, MonoBehaviour mono=null, bool alsoRumble=false, int controllerID=-1, bool threaded=false, bool fullIntensity=true) |
| Plays a continuous haptic of the specified intensity, sharpness and duration More...
|
|
static void | ContinuousHaptic (bool vibrateiOS, float iOSIntensity, float iOSSharpness, HapticTypes fallbackOldiOS, bool vibrateAndroid, float androidIntensity, float androidSharpness, bool vibrateAndroidIfNoSupport, bool rumble, float rumbleLowFrequency, float rumbleHighFrequency, int controllerID, float duration, MonoBehaviour mono=null, bool threaded=false, bool fullIntensity=true) |
| Plays a continuous haptic, full options signature More...
|
|
static void | UpdateContinuousHaptic (float intensity, float sharpness, bool alsoRumble=false, int controllerID=-1, bool threaded=false) |
| Updates a continuous haptic while it's playing. Not supported on Android for now, until Google adds API support for that More...
|
|
static void | UpdateContinuousHaptic (bool ios, float iosIntensity, float iosSharpness, bool android, float androidIntensity, float androidSharpness, bool rumble, float rumbleLowFrequency, float rumbleHighFrequency, int controllerID=-1, bool threaded=false) |
| Updates a continuous haptic while it's playing. Not supported on Android for now, until Google adds API support for that More options signature More...
|
|
static void | StopAllHaptics (bool alsoRumble=false) |
| Stops all currently running haptics More...
|
|
static void | StopContinuousHaptic (bool alsoRumble=false) |
| Stops all running pattern or continuous haptics More...
|
|
static void | AdvancedHapticPattern (string iOSJSONString, long[] androidPattern, int[] androidAmplitudes, int androidRepeat, long[] rumblePattern, int[] rumbleLowFreqAmplitudes, int[] rumbleHighFreqAmplitudes, int rumbleRepeat, HapticTypes fallbackOldiOS=HapticTypes.None, MonoBehaviour coroutineSupport=null, int controllerID=-1, bool threaded=false) |
| Plays a haptic pattern, the most complex type of haptic, defined by a JSON string on iOS, and a pattern on Android More...
|
|
static void | AdvancedHapticPattern (bool ios, string iOSJSONString, bool android, long[] androidPattern, int[] androidAmplitudes, int androidRepeat, bool vibrateAndroidIfNoSupport, bool rumble, long[] rumblePattern, int[] rumbleLowFreqAmplitudes, int[] rumbleHighFreqAmplitudes, int rumbleRepeat, HapticTypes fallbackOldiOS=HapticTypes.None, MonoBehaviour coroutineSupport=null, int controllerID=-1, bool threaded=false) |
| Plays a advanced haptic pattern, More...
|
|
static float | Remap (float x, float A, float B, float C, float D) |
| Remaps value x between AB to CD More...
|
|
This class will allow you to trigger vibrations and haptic feedbacks on both iOS and Android, or on each specific platform independently.
For haptics patterns, it takes inspiration from the iOS guidelines : https://developer.apple.com/ios/human-interface-guidelines/user-interaction/feedback Of course the iOS haptics are called directly as they are, and they're crudely reproduced on Android. Feel free to tweak the patterns or create your own.
Here's a brief overview of the patterns :
- selection : light
- success : light / heavy
- warning : heavy / medium
- failure : medium / medium / heavy / light
- light
- medium
- heavy
- soft
- rigid
In addition, this class will also let you trigger core haptics on supported devices running recent versions of iOS (after iOS 13). These let you trigger transient or continuous haptics, or play AHAP based JSON strings for even more control.