25 lines
608 B
C#
25 lines
608 B
C#
#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 |