Skip to content

Commit adafd36

Browse files
committed
Prevent haptic feedback from executing in the editor.
1 parent 1eea433 commit adafd36

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Scripts/HapticFeedback.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ public static class HapticFeedback
99
public static void LightFeedback()
1010
{
1111

12-
#if UNITY_IPHONE
12+
#if UNITY_IPHONE && !UNITY_EDITOR
1313
iOS.HapticFeedback.IOSUIImpactFeedbackGenerator("light");
14-
#elif UNITY_ANDROID
14+
#elif UNITY_ANDROID && !UNITY_EDITOR
1515
Android.HapticFeedback.PerformHapticFeedback(Android.HapticFeedbackConstants.CONTEXT_CLICK);
1616
#endif
1717

@@ -20,9 +20,9 @@ public static void LightFeedback()
2020
public static void MediumFeedback()
2121
{
2222

23-
#if UNITY_IPHONE
23+
#if UNITY_IPHONE && !UNITY_EDITOR
2424
iOS.HapticFeedback.IOSUIImpactFeedbackGenerator("medium");
25-
#elif UNITY_ANDROID
25+
#elif UNITY_ANDROID && !UNITY_EDITOR
2626
Android.HapticFeedback.PerformHapticFeedback(Android.HapticFeedbackConstants.VIRTUAL_KEY);
2727
#endif
2828

@@ -31,9 +31,9 @@ public static void MediumFeedback()
3131
public static void HeavyFeedback()
3232
{
3333

34-
#if UNITY_IPHONE
34+
#if UNITY_IPHONE && !UNITY_EDITOR
3535
iOS.HapticFeedback.IOSUIImpactFeedbackGenerator("heavy");
36-
#elif UNITY_ANDROID
36+
#elif UNITY_ANDROID && !UNITY_EDITOR
3737
Android.HapticFeedback.PerformHapticFeedback(Android.HapticFeedbackConstants.LONG_PRESS);
3838
#endif
3939

0 commit comments

Comments
 (0)