Files

25 lines
608 B
C#
Raw Permalink Normal View History

2026-07-15 16:19:07 +08:00
#if UNITY_IOS
using System.Runtime.InteropServices;
using UnityEngine;
public class HapticManager
{
[DllImport("__Internal")]
private static extern void TriggerCustomHaptic(float intensity, float sharpness, float duration);
public static void TriggerHapticFeedback(float intensity, float sharpness, float duration)
{
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
TriggerCustomHaptic(intensity, sharpness, duration);
}
else
{
Debug.Log("Haptic feedback is only available on iOS.");
}
}
}
#endif