Performs custom Vibrate functions on an Android device and standard vibrations on iOS
Overview
This Unity Package will provide you with simple functions to call as and when you require a mobile device to vibrate.
Android allows for customisable lengths whereas iOS will perform a standard 500ms vibration.
Simply have the package inside your project and everything is ready to go!
Public Methods
public static void Vibrate(long milliseconds) { ... }
public static void Vibrate(Vibration vibration) { ... }
public static void Cancel() { ... }
Vibrator.Vibrate(long milliseconds) | Will vibrate an android device for the specified number of milliseconds (1/1000th of a second). iOS will vibrate for a standard 500ms |
Vibrator.Vibrate(Vibration vibration) | Will vibrate an android device for one of the pre-set vibration lengths in the Vibration enum. Values are as follows: SHORT = 100ms MEDIUM = 250ms LONG = 500ms VERY_LONG = 1000ms iOS will, again, only vibrate for a standard 500ms |
Vibrator.Cancel() | Will cancel any active vibration performing on the device. This method will only work on Android devices, iOS will not respond to this method call. |
Vibrator.IsAndroid() | Returns true of false depending on if the current device is Android or not. |
Feel free to use this is any of your projects without accreditation =)