14 private bool debugMode =
false;
20 if (UnityEngine.iOS.Device.generation > UnityEngine.iOS.DeviceGeneration.iPhone8 &&
21 UnityEngine.iOS.Device.systemVersion.CompareTo(
"13") > 0)
23 DebugMode(
"Haptic capabilities supported on iOS.");
27 DebugMode(
"Haptic capabilities not supported on this iOS device.");
32#if !ENABLE_METAQUEST && !ENABLE_OPENXR && UNITY_ANDROID && !UNITY_EDITOR
33 AndroidJavaClass UnityPlayer =
new AndroidJavaClass(
"com.unity3d.player.UnityPlayer");
34 AndroidJavaObject currentActivity = UnityPlayer.GetStatic<AndroidJavaObject>(
"currentActivity");
35 AndroidJavaObject vibrator = currentActivity.Call<AndroidJavaObject>(
"getSystemService",
"vibrator");
36 bool hasVibrator = vibrator.Call<
bool>(
"hasVibrator");
40 DebugMode(
"Haptic capabilities supported on Android.");
44 DebugMode(
"Haptic capabilities not supported on this Android device.");
49#if UNITY_STANDALONE_WIN
50 if (Input.GetJoystickNames().Length > 0)
52 DebugMode(
"GameInput/XInput controller connected on Windows. Haptic feedback enabled.");
56 DebugMode(
"No GameInput/XInput controller connected on Windows. No haptic feedback.");
61#if ENABLE_METAQUEST || ENABLE_OPENXR
62 if (XRSettings.enabled)
68 DebugMode(
"Meta Quest/Open XR not enabled.");
74 DebugMode(
"Platform is PS5. Haptic feedback enabled.");
79 DebugMode(
"Platform is Nintendo Switch. Haptic feedback enabled.");