Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug After enabling XR plugin management, rendering stops working

Discussion in 'VR' started by olavrv, Feb 17, 2023.

  1. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    494
    In a clean project using Unity 2022.2 (any version) I do the following:

    1. Enable XR Plugin Management
    2. Make sure XR rendering on camera in scene i disabled
    3. Make a build (mono or il2cpp)
    4. Start build - camera rendering "frozen"
    If XR rendering is enabled on camera, it works fine in build. Also, if making build without XR Plugin Management installed it works fine.

    Also, everything works 100% in development build, but not in regular mono or il2cpp builds.
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    3,453
    How do you 'enable xr rendering'?
    Do you use gameobject - convert main camera to xr rig?
    That works for me in the latest 2022.2 version
     
  3. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    494
    I use the method described method below, works fine in editor and development build - but not in regular mono and il2cpp builds:

    Code (CSharp):
    1.  
    2.     XRLoader m_SelectedXRLoader;
    3.  
    4.     void StartXR(int loaderIndex)
    5.     {
    6.         // Once a loader has been selected, prevent the RuntimeXRLoaderManager from
    7.         // losing access to the selected loader
    8.         if (m_SelectedXRLoader == null)
    9.         {
    10.             m_SelectedXRLoader = XRGeneralSettings.Instance.Manager.activeLoaders[loaderIndex];
    11.         }
    12.         StartCoroutine(StartXRCoroutine());
    13.     }
    14.  
    15.     IEnumerator StartXRCoroutine()
    16.     {
    17.         Debug.Log("Init XR loader");
    18.  
    19.         var initSuccess = m_SelectedXRLoader.Initialize();
    20.         if (!initSuccess)
    21.         {
    22.             Debug.LogError("Error initializing selected loader.");
    23.         }
    24.         else
    25.         {
    26.             yield return null;
    27.             Debug.Log("Start XR loader");
    28.             var startSuccess = m_SelectedXRLoader.Start();
    29.             if (!startSuccess)
    30.             {
    31.                 yield return null;
    32.                 Debug.LogError("Error starting selected loader.");
    33.                 m_SelectedXRLoader.Deinitialize();
    34.             }
    35.         }
    36.     }
    37.  
    38.     void StopXR()
    39.     {
    40.         Debug.Log("Stopping XR Loader...");
    41.         m_SelectedXRLoader.Stop();
    42.         m_SelectedXRLoader.Deinitialize();
    43.         m_SelectedXRLoader = null;
    44.         Debug.Log("XR Loader stopped completely.");
    45.     }
    Method found here: https://docs.unity3d.com/Packages/com.unity.xr.management@4.3/manual/index.html

    You can download my test project here: https://drive.google.com/file/d/1bnPNposzHYkDftmUBX-3f1CvhSesHc5t/view?usp=share_link

    Just run it in editor, press "v" key on keyboard to toggle XR on/off - then make a build and do the same to reproduce issue.

    PS: Before updating to Unity 2022.2, I could just toggle XR Rendering on/off on camera, but this doesn't work after upgrading.
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    3,453
    Maybe check for errors. In non-development builds there will be a log file in appdata.
    I personally never toggled VR, so cannot help much.

    If the code works in 2022 but doesn't now without indication on what, you can make a bug report (attatch both projects if possible)
     
  5. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    494
    No errors in player log, or in development build console.
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    3,453
    Then i suggest filing a bug report. Share the ticket id here as well
     
  7. nilagard

    nilagard

    Joined:
    Jan 13, 2017
    Posts:
    77
    Dude, file a bug report and ticket like we're supposed to do when we encounter a bug.
     
    DevDunk likes this.
  8. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    494
    I have filed one, but these usually takes months before they are fixed.
     
  9. nilagard

    nilagard

    Joined:
    Jan 13, 2017
    Posts:
    77
    That is correct, I suggest you find a workaround for your problem in the meantime while you wait for a dev to take a look at your report.
     
  10. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    494
    This is what I am trying to do...
     
  11. nilagard

    nilagard

    Joined:
    Jan 13, 2017
    Posts:
    77
    What you are trying to do is force someone to take a look at your ticket, this is wrong. Wait for a reply like everyone else. Good luck!
     
  12. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    494
    Thank you, I can use some good luck!
     
    nilagard likes this.
  13. LianneUnityXR

    LianneUnityXR

    Unity Technologies

    Joined:
    Jan 31, 2023
    Posts:
    14
    Hey @olavrv,

    Would you be able to post your bug report IN number for your issue so we are better able to track it and it's progress.
    Unfortunately, I am unable give a time estimate on when it will be looked at but our team has recognized this as something we should definitely look into.

    Also if you are able to add a zip file test project that contains the bug to your bug report (or even this forum) that would also help make the process go faster when we are able to get to it.

    Thanks for bringing this to our attention.
     
    olavrv likes this.
  14. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    494
    IN number for bug report: IN-32575

    Download link to Unity project re-producing issue: CLICK HERE TO DOWNLOAD

    Instructions:
    1. Open "Test Scene"
    2. Press PLAY
    3. toggle XR rendering on/off using "V" key on keyboard (also changes camera, but same happens when using one camera)
    4. Make a build
    5. In build, toggle XR rendering on/off using "V" key on keyboard
    6. Observe that when switching XR rendering off, rendering looks strange
    NB: This only happens when VR headset is connected. I am using Windows Mixed Reality portal and HP Reverb G2.
     
    LianneUnityXR and DevDunk like this.
  15. LianneUnityXR

    LianneUnityXR

    Unity Technologies

    Joined:
    Jan 31, 2023
    Posts:
    14
    Thanks!
     
    olavrv likes this.
  16. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    494
    Did another test: It works with multipass, so seems to be Single-pass instanced related
     
  17. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    494
  18. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    494
    @LianneUnityXR It is over 3 months since I reported this issue, but it has not been resolved. Do you have any news? Eager to upgrade to 2022.2. Thank you very much!