Class Vibrator
Inheritance
System.Object
Vibrator
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ImpulseVibrations
Assembly: Assembly-CSharp.dll
Syntax
public class Vibrator
Properties
| Improve this Doc View SourceIsHapticEngineSupported
Checks the device have a haptic engine Added in Android API level 11 iOS 10+
Declaration
public static bool IsHapticEngineSupported { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
| Improve this Doc View SourceAndroidVibrate(HapticFeedbackConstants, HapticFeedbackConstants)
This uses performHapticFeedback function from the View class to trigger haptic feedbacks.
Declaration
public static bool AndroidVibrate(HapticFeedbackConstants feedbackConstant, HapticFeedbackConstants flag = HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING)
Parameters
| Type | Name | Description |
|---|---|---|
| HapticFeedbackConstants | feedbackConstant | |
| HapticFeedbackConstants | flag |
Returns
| Type | Description |
|---|---|
| System.Boolean |
AndroidVibrate(Int64, Int32)
This uses the android.os.Vibrator to trigger Vibrate function.
Declaration
public static void AndroidVibrate(long milliseconds, int amplitude = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | milliseconds | |
| System.Int32 | amplitude |
GetAndroidSDKLevel()
Returns Android SDL version level of the device.
Declaration
public static int GetAndroidSDKLevel()
Returns
| Type | Description |
|---|---|
| System.Int32 |
iOSVibrate(ImpactTypeFeedback, Single)
This uses iOS's UIImpactFeedbackGenerator class for haptics.
Declaration
public static void iOSVibrate(ImpactTypeFeedback impact, float intensity = -1F)
Parameters
| Type | Name | Description |
|---|---|---|
| ImpactTypeFeedback | impact | |
| System.Single | intensity |
iOSVibrate(NotificationTypeFeedback)
This uses iOS's UINotificationFeedbackGenerator class for haptics.
Declaration
public static void iOSVibrate(NotificationTypeFeedback notification)
Parameters
| Type | Name | Description |
|---|---|---|
| NotificationTypeFeedback | notification |
iOSVibrate(SelectionTypeFeedback)
This uses iOS's UISelectionFeedbackGenerator class for haptics.
Declaration
public static void iOSVibrate(SelectionTypeFeedback selection = SelectionTypeFeedback.SELECTION)
Parameters
| Type | Name | Description |
|---|---|---|
| SelectionTypeFeedback | selection |
UnityVibrate()
Shorthand to call the default Vibrate function provided by Unity Engine if you're already using this class.
Also, Lazy hack to add android.permission.VIBRATE permission into the AndroidManifest.xml.
Declaration
public static void UnityVibrate()