Search Unity

  1. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

[SteamVR] GetPoseActionData error

Discussion in 'AR/VR (XR) Discussion' started by totorufo, Feb 5, 2020.

  1. totorufo

    totorufo

    Joined:
    Sep 2, 2015
    Posts:
    7
    Hello,

    Some time ago in my project (Unity 5.6) I created a toggle between normal mode and VR mode. It works well.
    Now I have made a upgrade to Unity 2019.2.9f1 and I have made a upgrade to SteamVR as well.

    Problems!

    1.I start as normal mode, I change to VR mode => All works well.
    2.I return to normal mode and I change again to VR mode => This time i have an error and controlers don't appear
    [SteamVR] GetPoseActionData error (/actions/default/in/SkeletonLeftHand): InvalidHandle Handle: 1152966429964763365. Input source: Any

    I have created a simple test in "SteamVR\Simple Sample" :
    upload_2020-2-5_14-7-7.png

    In Mode GameObject I have the next script:
    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3. using UnityEngine.XR;
    4.  
    5. public class Mode : MonoBehaviour
    6. {
    7.     public GameObject normal;
    8.     public GameObject vr;
    9.  
    10.     private GameObject m_SteamVRGameObject;
    11.  
    12.     void Start()
    13.     {
    14.         StartCoroutine(ExitVR());
    15.     }
    16.  
    17.     void Update()
    18.     {
    19.         if (Input.GetKeyUp(KeyCode.O) && normal.activeSelf)
    20.         {
    21.             StartCoroutine(GoInVR());
    22.         }
    23.  
    24.         if (Input.GetKeyUp(KeyCode.P) && vr.activeSelf)
    25.         {
    26.             StartCoroutine(ExitVR());
    27.         }
    28.     }
    29.  
    30.     private IEnumerator GoInVR()
    31.     {
    32.         normal.SetActive(false);
    33.  
    34.         XRSettings.LoadDeviceByName("OpenVR");
    35.         yield return null;
    36.         XRSettings.enabled = true;
    37.  
    38.         if (SteamVRGameObject != null)
    39.         {
    40.             SteamVRGameObject.SetActive(true);
    41.         }
    42.  
    43.         vr.SetActive(true);
    44.     }
    45.  
    46.     private IEnumerator ExitVR()
    47.     {
    48.         vr.SetActive(false);
    49.  
    50.         if (SteamVRGameObject != null)
    51.         {
    52.             SteamVRGameObject.SetActive(false); // => Otherwise null ref when we return to normal mode
    53.         }
    54.  
    55.         XRSettings.LoadDeviceByName("None");
    56.         yield return null;
    57.         XRSettings.enabled = false;
    58.  
    59.         normal.SetActive(true);
    60.     }
    61.  
    62.     private GameObject SteamVRGameObject
    63.     {
    64.         get
    65.         {
    66.             if (m_SteamVRGameObject == null)
    67.             {
    68.                 m_SteamVRGameObject = GameObject.Find("[SteamVR]");
    69.             }
    70.  
    71.             return m_SteamVRGameObject;
    72.         }
    73.     }
    74.  
    75. }
    upload_2020-2-5_14-12-54.png

    And this is my "Player Settings"
    upload_2020-2-5_14-14-28.png

    Any ideas?

    Thanks
     
unityunity