提交
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user