Klutch
Klutch

Reputation: 11

Unity crashes on play setting up hand tracking (Oculus Quest)

When trying to set up hand tracking following the hand tracking-documentation unity just shuts down when pressing play without any crashlog/warning. Here are the steps that I have done up until the crash to reproduce my problem:

  1. Creating completely new scene.

  2. Importing the Oculus Integration from asset store.

  3. Switching platform to Android.

  4. Add OVRCameraRig to hierachy.

  5. Change OVRCameraRig's Hand tracking support to "Controllers & Hands" on OVR Manager-script.

Up to step 5 I can press play whenever and it starts as usual. But when doing the next step it crashes everytime.

  1. Add "OVRHandPrefab" to OVRCameraRig > TrackingSpace > LeftHandAnchor/RightHandAnchor.

Has anyone experienced a similar problem to this?

Thanks in advance!

EDIT: Unity does not crash when removing Link cable from laptop. So has certainly something to do with link.

Upvotes: 0

Views: 1329

Answers (3)

Ryan Cameron
Ryan Cameron

Reputation: 21

I wasnt getting crashes, but the hands seem to display on top of the controllers when switching so I added this script to the OVRCameraRig.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CustomHandOverride : MonoBehaviour
{
    public GameObject ovrHandPrefabLeft;
    public GameObject ovrHandPrefabRight;

    void Update()
    {
        if (OVRPlugin.GetHandTrackingEnabled())
        {
            ovrHandPrefabLeft.SetActive(true);
            ovrHandPrefabRight.SetActive(true);
        }
        else
        {
            ovrHandPrefabLeft.SetActive(false);
            ovrHandPrefabRight.SetActive(false);
        }
    }
}

Oculus Pro Unity 2023.3.1f1

Upvotes: 0

MostlyHarmless
MostlyHarmless

Reputation: 3

I don't know if you were able to solve this issue or not, but for any other person who is facing a similar issue, here is how I solved it:

  1. When you add OVRHandPrefab to LeftHandAnchor and RightHandAnchor, set the gameobject to false in the inspector.
  2. Then in your script, check if handtracking is enabled by running this code in Update() OVRPlugin.GetHandTrackingEnabled()
  3. Set both the OVRHandPrefab to true only when OVRPlugin.GetHandTrackingEnabled() returns true, something like this:

    if (OVRPlugin.GetHandTrackingEnabled())
    {
        ovrHandPrefabLeft.SetActive(true);
        ovrHandPrefabRight.SetActive(true);
    }
    else
    {
        ovrHandPrefabLeft.SetActive(false);
        ovrHandPrefabRight.SetActive(false);
    }
    

This should avoid Unity from crashing.

Upvotes: 0

chantey
chantey

Reputation: 5847

Have you tried enabling hand tracking in your Quest Headset (while unplugged)?

Its in Settings -> Experiments -> Enable Hand Tracking

I also have 'Auto detect hands or controllers' enabled. To see your hands, the new OVRCustomHandPrefab does the trick.

[Edit]

Also the headset seems to cause crashes after its been sitting on the desk connected to Link for more than a few minutes. Unplugging and reconnecting will refresh it.

Upvotes: 0

Related Questions