Forum Discussion
thatnzguy22
3 years agoExplorer
Haptics SDK for Unity not working
I'm trying out the new Haptics SDK for Unity
I want to test it by playing a single haptic, but when I use this script I get an error with no haptics (testing in Unity editor 2022.2.13, with Air Link to a Quest 2)
Script:
public class OculusHapticClipTest : MonoBehaviour
{
[SerializeField] private HapticClip _hapticClip;
private HapticClipPlayer _hapticClipPlayer;
private void Start()
{
_hapticClipPlayer = new HapticClipPlayer(_hapticClip);
_hapticClipPlayer.Play(HapticInstance.Hand.Left);
}
}
Error:
Error: HapticsSDK has already been initialized
UnityEngine.Debug:LogError (object)
Oculus.Haptics.HapticInstance:Initialize () (at ./Packages/com.meta.xr.sdk.haptics/Runtime/HapticInstance.cs:101)
Oculus.Haptics.HapticInstance:MakeClipFromJson (string) (at ./Packages/com.meta.xr.sdk.haptics/Runtime/HapticInstance.cs:127)
Oculus.Haptics.HapticClipPlayer:.ctor (Oculus.Haptics.HapticClip) (at ./Packages/com.meta.xr.sdk.haptics/Runtime/HapticClipPlayer.cs:77)
OculusHapticClipTest:Start () (at Assets/CombatProto/Impact CFX Haptic/OculusHapticClipTest.cs:14)
I can't find anything else that may be calling new HapticClipPlayer() anywhere else in the scene.
Any tips? Thanks
1 Reply
Replies have been turned off for this discussion
- thatnzguy22Explorer
Ah okay it works in a build, but not in Unity Editor using Link.
Please fix this
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device