Skip to content

Comp3interactive/Unity-Vibrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Unity-Vibrator

Codacy Badge

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 =)

About

Performs custom Vibrate functions on an Android device and standard vibrations on iOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published