Search Unity

Bug TryGetBoundaryPoints returns false when starting application without SteamVR running.

Discussion in 'VR' started by hasseyg, Feb 6, 2023.

  1. hasseyg

    hasseyg

    Joined:
    Nov 16, 2013
    Posts:
    81
    Hi, I have ran into a problem using the OpenXR plugin in Unity 2020.3.44, where TryGetBoundaryPoints will return false whenever I start the application with SteamVR not already running. Even when I switch scenes within the application, of which then calls the method again at the start of the new scene, it still returns false. I have to then quit the application and start it again, with SteamVR still running in order for it to return true.

    Has anyone else ran into this problem and is there anything I can call in order to get it to work? The wierd thing is even though the method returns false, when checking if the XRInputSubsystem is running it returns true, so this has left me scratching my head.

    thanks
     
  2. hasseyg

    hasseyg

    Joined:
    Nov 16, 2013
    Posts:
    81
    For anyone with the same problem I have found a quick fix. If TryGetBoundaryPoints returns false, then I call this coroutine once only, if it returns false again, then I just continue without it (quest 2 using oculus link always return false).
    I am testing using a Valve Index.

    Code (CSharp):
    1.  IEnumerator ReloadXR()
    2.     {      
    3.         XRGeneralSettings.Instance.Manager.StopSubsystems();
    4.         XRGeneralSettings.Instance.Manager.DeinitializeLoader();
    5.         yield return new WaitForEndOfFrame();
    6.         XRGeneralSettings.Instance.Manager.InitializeLoaderSync();
    7.         XRGeneralSettings.Instance.Manager.StartSubsystems();
    8.         yield return new WaitForEndOfFrame();
    9.         SetUpBoundary();
    10.     }
     
  3. nilagard

    nilagard

    Joined:
    Jan 13, 2017
    Posts:
    77
    Good solution! But that logic is very expensive and will run every frame. Maybe try to make it into an event and listen for an update if steamvr is enabled? Building the project will also run differently than your editor and will "force" steamvr to start if that is your prefered build setup
     
  4. hasseyg

    hasseyg

    Joined:
    Nov 16, 2013
    Posts:
    81
    Hi, yes the issue is not with getting steamvr to run, it's that if steamvr is not already running and the application starts it, then TryGetBoundaryPoints will return false for the whole time the application is open. You have to have steamvr running already for it to work. Obviously this is not ideal as there will be many times that the user starts the application without steamvr running. Thats why I used the bug label, as I think that is not supposed to happen. I have tested this both in the editor and in a build.

    This fix will only run once at start up, so it is okay for now.
     
  5. nilagard

    nilagard

    Joined:
    Jan 13, 2017
    Posts:
    77
  6. hasseyg

    hasseyg

    Joined:
    Nov 16, 2013
    Posts:
    81
    Ok, thanks I will take a look. I would just like to correct something I have written, which was about the quest 2 always returning false. I have just tested it and it does actually work correctly with the quest 2 (using oculus link) and I was mistaken. It has been quite a while since I last tested it with this device and obviously things have now changed. However, I will leave the fix in place for the other headsets, until I find a more suitable one.