Search Unity

UWP twice XRSettings.enabled = true crash and exit game

Discussion in 'VR' started by IElectric, Dec 23, 2018.

  1. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, I have a strange behavoir on my game after update from Unity 2018.2 to Unity 2018.3, this is my code :

    When I first call EnableVisor all works properly and the game start in WMR mode but if I call DisableVisor and then again EnableVisor the game window close and exit.

    This not happen in the Unity editor and in the prior version of Unity like 2018.2.7f1, in the old version of Unity prior 2018.3 I can enable and disable WMR whitout problem, I don't know where to start to find the issue because debugger doesn't show me any exceptions.

    I'm using :

    Unity 2018.3.0f2;
    Visual Studio 2017 Version 15.9.4

    I have observed that when I call UnityEngine.XR.XRSettings.enabled = true a second time the game exit.

    Thank you very much, Best regards...
     
    Last edited: Nov 27, 2020
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,438
    are there any messages in the player.log?
     
  3. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, thank you for your suggestion, I don't kow exactly where I can find player.log, in my AppData\LocalLow i can't find it, but I have execute the game in debug mode and when I try to enable a second time WMR mode I have found the following errors…

    seems something wrong on spatial input manager initialization, the configuration of my project is that

    I have try also with .NET 4.x Scripting backend but nothing, on my published game at

    https://www.microsoft.com/store/apps/9P5GJQXZL1BQ

    and made by Unity 2018.2.7f1 I have no problem to enable WMR more than one time, Best regards...
     
    Last edited: Nov 27, 2020
  4. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Maybe try loading the sdk "None" in the list, this might help instead of loading a blank string? This would end XR and the app would most likely go to a desktop app.
     
  5. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, thank you for your reply, I have tried to fit "None" istead of blank string but it doesn't work, the second time that I try to activate VR mode the game window close.

    This not happen in the Unity editor and in the old version of the game published on the store, I don't know what to do, please help, Best regards…]
     
    Last edited: Nov 27, 2020
  6. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    I think this is coming down to a misunderstanding in the code for the xrsettings.enabled. I believe that you are disabling all of XR by setting that API to false. When this happens you turn off the list and all of XR.

    If you want to disable to HMD, load "None" in the list, and then to re-nable the the HMD load the XR SDK you want to use.

    I think it comes down to be to aggressive on turning off the HMD
     
  7. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, I have tried to not call xrsettings.enabled = false, and different combination of code, but nothing to do, I'm still on the same problem;

    In Unity editor when LoadDeviceByName("None") is called the Windows Mixed Reality portal come back to HOME, and the game can be re-enabled in VR mode;

    In the Master Build of the game when LoadDeviceByName("WindowsMR") is called for the first time the game go in VR mode;

    But when LoadDeviceByName("None") is called the Windows Mixed Reality portal go to black backgound;

    The next time that the LoadDeviceByName("WindowsMR") is called the game crash and close;

    I'm sorry but at this time I'm very confused, I'm not too expert but I think that there is a bug in the generated code, the same code to enable/disable VR works properly in the old version of Unity, I'm sure on 2018.1.6f1 version, thank you a lot for your support, Cheers...
     
    Last edited: Nov 27, 2020
  8. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, same code on standalone build works perfect, OpenVR over Windows Mixed Reality can be enabled and disabled more than one time.

    I will very appreciate if someone can help me to solve the issue beacuse I'm stuck to update my game on Microsoft Store, the problem is the code that enabled a second time the Virtual Reality mode on UWP build.

    In the Unity editor the UWP works perfect but in the master build of the game the second time that I try to enable VR the game crash and exit, Thank you very much, Best regards...
     
  9. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Hey IElectric, sorry for the late-late reply. We were on holiday for the last bit of December.

    I'd love to have you file a new issue for us and we can take a look at a min-repro project if you reproduce this consistently. If you file a bug, post the issue number here so I can go nudge it along right away.
     
  10. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, I have opened an issue, thanks in advance for your support, Cheers…

    next I explain in more detail what happen...
     
    Last edited: Nov 27, 2020
  11. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    This is what happen in UWP master build version;

    this is the code;

    when I enable the VR the first time the game works properly and the WMR portal show the HDM view;

    when I disable the VR the first time the game still works but the WMR device portal is black;

    the next time that I re-enable the VR mode the game freeze, crash, exit and the WMR portal is black until the game close;

    I catch some errors in debug mode but I don't know if is the real cause of the crash;

    On debug mode attached to CPP project the game crash after loading a second time the "WindowsMR" device at this line of code :

    UnityEngine.XR.XRSettings.enabled = true;

    continue...
     
    Last edited: Nov 27, 2020
  12. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    This is what happen in standalone build version (same code as UWP version);

    when I enable the VR the first time the game works properly and the WMR portal show the HDM view;

    when I disable the VR the first time the game still works and the WMR device portal is active;

    the next time that I re-enable the VR mode the game works properly;

    each time I disable and enable the VR mode the game still works;

    continue...
     
    Last edited: Nov 27, 2020
  13. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    This is what happen in the Unity UWP editor (same code);

    when I enable the VR the first time the game works properly and the WMR portal show the HDM view;

    when I disable the VR the first time the game still works and the WMR device portal show the cliff house;

    the next time that I re-enable the VR mode the game works properly;

    each time I disable and enable the VR mode the game still works;

    the build settings are

    the player settings are

    I'm using :

    Unity 2018.2.0f2
    Visual Studio 2017 Community

    Best regards...
     
    Last edited: Nov 27, 2020
  14. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Thanks for the info and I found your issue in our system! I will get this looked at soon as we can and if we need any additional details we may reach out in email from anyone in the QA team when we try to reproduce the issue.
     
  15. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, I have tested on Unity 2019.1 but the issue is still present. Someone know a workaround to avoid the crash on UWP build of WMR when XRSettings.enabled = false and then = true ? The latest version of Unity where it's works was 2018.2.xx, thank you very much, Best regards...
     
  16. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, any chance to know when the issue will be fixed ? I'm stuck on publish an update on Microsoft Store because the game crash, I'd like to apply a workaround but I don't know where to start, thank you, Best Regards...
     
  17. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Hello IElectric, I went to double check your issue on my own project and could not reproduce it on the latest 2018.4 release. Would you be able to upgrade to 18.4 and checking if you still have the issue?
     
  18. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, I have updated my project to Unity 2019.1.4, do you think that is possible to downgrade the project to 2018.4 ? Thank you a lot for your reply, Cheers...
     
    Last edited: Jun 19, 2019
  19. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    We do not officially support downgrading of a project. Not to say it can't be done, but it's not something we support. Your mileage may vary if you attempt to do it.
     
  20. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, do you know if on Unity 2019.2.2f1 the issue is fixed ? I have tested it but seems doesn't work, thank you, Cheers…
     
    Last edited: Nov 27, 2020
  21. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    @IElectric can you file a new bug for us please, I just double-checked 19.2.2f1 and am not crashing when toggling XR Settings. Make sure to include a minimum repro project attached with whatever script you're using to toggle it off and back on again.
     
  22. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hi, I'm using Unity 2019.2.2f1 and Visual Studio Community 2017 15.9.4, I hope that the next image is useful, in any case where can I download your test project ? Thank you very much, Cheers…

    This exception happen when I toggle XR from ON to OFF and then ON again

    I belive that is the same issue…
     
    Last edited: Nov 27, 2020
  23. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    I was using the test project attached to 1155138. File a new bug for me under Help > Report a Bug and I'll take a look at your repro project. Perhaps you have the magic touch that still reproduces the crash.
     
  24. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Sorry, please give me the link to download the test project 1155138, I can't find it, thank you, Cheers...
     
  25. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Unfortunately we cannot share projects reported through our bug reporter. That goes against keeping them confidential (even if you reported the bug originally).
     
  26. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Hello,

    Please make sure to have built a min repro project (a small project that has only what is required to reproduce the bug) that we can use to produce the bugs. Then please follow these steps.

    Steps:
    1.) Open the current unity editor you are using
    2.) Build a min repro project
    3.) Click the Help tab
    4.) Click Troubleshoot Issue...
    5.) Then in the bottom right of the menu that pops click Report a new Issue.

    Without these steps there is not really anymore support we can provide without being able to reproduce the issue on our side.

    Thank you,
    Wesley
     
  27. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, I know that is better to open an issue tracker but at this time I'm stuck on the test project. I have build a test project on windows mixed reality, you can download it at

    the project works properly on standalone OpenVR over Windows Mixed Reality

    works also properly in the Unity editor as UWP Windows Mixed Reality

    but doesn't work on Windows Mixed Reality UWP build

    Thanks in advance if you can test the project and explain me what is wrong, Cheers...

    I'm using Unity 2019.2.2f1 and Visual Studio 2017 Community 15.9.14
     
    Last edited: Nov 27, 2020
  28. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, I've understand why my test project doesn't work. On my notebook there are two graphics adapter, one integrated and an high performance GPU, by default nvidia settings select low performance GPU and the test project doesn't work.

    Now the test project works because I have forced the graphics adapter to works on high performance GPU, now I can open another issue tracker because I don't understand why my game crash when Windows Mixed Reality is switched ON, then OFF, then ON again, Best Regards…

    High performance GPU settings

    The test project crash when VR is switched ON again
     
    Last edited: Nov 27, 2020
  29. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Issue opened, Cheers…
     
    Last edited: Nov 27, 2020
    JasonCostanza likes this.
  30. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Thank you IElectric, we will take a look at that as soon as we can
     
  31. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, sadly I need to signal that on the latest version of Unity 2019.2.13f1 my game still has the same problem on WMR mode.

    I have build my game as UWP, I'm using Visual Studio 2017 Community and the situation is that :

    In Unity Editor as universal Windows Platform the game works properly, Windows Mixed Reality can be enabled and disabled always and the game doesn't crash;

    Standalone Build as x64 .NET WMR over SteamVR works properly, XR can be enabled and disabled always and the game doesn't crash;

    UWP Build as Master crash when the Windows Mixed Reality is enabled a second time;

    Seems that the issue is fixed, problably it's my computer, my operating system or my HDM visor but I would like to understand why last year with the Unity 2018.2.xx the same game and code works properly with WMR enable/disable.

    This is the error that Visual Studio show in debug mode :

    I'm waiting Unity 2019.3 but until this version I'd like to know if someone else have the same problem, thank you very much, Best Regards...
     
    Last edited: Nov 27, 2020
    JasonCostanza likes this.
  32. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Hello, if you're reproducing this in a new editor version, let's have you file a new bug and we'll treat it in a brand new light. There's been a lot of change since we tackled this last time so things might be quite different than before. Can you file a bug and post the number here please?
     
  33. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    Hello, can I ask you to send me a mini project example that I can test on my system ? If the project works on Unity system the issue is my project. I hope is possible to give me a link to download the example project on a private message, thank you very much for your support, Cheers...
     
  34. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Unfortunately we are not authorized to provide project files. We will need a bug report from your project or a new minimum repro project you create and we can use that to diagnose the issue you're seeing or advise a change in your project to resolve it.
     
  35. IElectric

    IElectric

    Joined:
    May 31, 2016
    Posts:
    215
    OK, thank you anyway, I will wait for Unity 2019.3, I develop videogames for hobby, is not a problem for me, Cheers...
     
    Last edited: Nov 26, 2019