ViveSoftware / ViveInputUtility-Unity

A toolkit that helps developing/prototyping VR apps.
http://u3d.as/uF7
Other
356 stars 82 forks source link

Unity crashes when attempting to hit play in the editor #241

Open tenebris93 opened 1 year ago

tenebris93 commented 1 year ago

Hi, I just updated a Unity project I have been working on from v1.13.4 of VIU to v1.17.0. I updated it because I wanted to start testing VIU with Open XR. However, recently I noticed that my Unity Editor keeps crashing when I attempt to hit play when I do not have my Oculus Quest headset attached to my PC with Oculus Link mode enabled. This was never the case before I updated VIU. I believe I should have everything enabled as I am supposed to but is it possible I forgot something? I am using Unity Version 2020.3.33f1 LTS and I'm developing for Android.

image image image image image image

tenebris93 commented 1 year ago

I just started testing some more by building to my headset and noticed by the controller wasn't being detected correctly. It's line render I used for the pointer was floating in 3D space. So I updated Open XR to the latest version which fixes that issue, but now android is showing as disabled in the VIU's settings menu and also it removed the Symbol VIU added. I also would like to add, I'm still crashing when trying to test within the Unity Editor. So updating all my libraries to the latest version did not fix my initial issue.

image

chengnay commented 1 year ago

I will check the problem you mentioned and get back to you ASAP. Sorry for the inconvenience.

chengnay commented 1 year ago

Hi @tenebris93, Sorry for the slow response. Regarding your first issue(crash), is it OK now? For your second issue, cannot check OpenXR Android it is due to the latest unity xr management remove OpenXRProjectValidationWindow. For the temporary fix, please update UnityEngineVRModuleEditor.cs manually. Add(new VRModuleManagerEditor.SymbolRequirement() { symbol = "VIU_OPENXR", reqTypeNames = new string[] { "UnityEditor.XR.OpenXR.OpenXRProjectValidation", "UnityEngine.XR.OpenXR.OpenXRSettings", "UnityEngine.XR.OpenXR.Features.OpenXRFeature", }, reqFileNames = new string[] { "OpenXRProjectValidation.cs", "OpenXRFeature.cs", }, });

tenebris93 commented 1 year ago

@chengnay It still crashes when I hit play. The workaround right now is to plug in a headset and enable Oculus Link. Once that is running, open unity again, and then when I play it outputs it to the headset for testing. Hopefully, this can be fixed in a future update.

Sorry for the dumb question, but for the second fix, is there a way to do this with package manager assets? If not then am I correct in assuming that I need to manually install the Unity Asset and then make the change?

Edit: whoops, forgot I already mentioned the workaround in the first post 🤦‍♂️

chengnay commented 1 year ago

Hi @tenebris93, For the second fix, you actually can copy existing VIU package from Library/PackageCache folder and paste it to Packages folder. image You can now modify the script.

tenebris93 commented 1 year ago

@chengnay Thanks for the help on how to implement the workaround. I have implemented it and will get back to you once I have finished testing to make sure nothing else weird happens.

tenebris93 commented 1 year ago

So I tested the workaround but now I have this issue. When I check the box this error now appears that prevents me from building. image

If I disable the meta option in the OpenXR settings. It will not allow me to build an apk and states in the console that I need to use the updated "meta" option. However, if I click "fix" it then disables the VIU option again.

chengnay commented 1 year ago

Hi @tenebris93, For this new issue, I will need to reproduce on my side in order to comment. Could you provide the plugin(Oculus Integration Unity Plugin? Oculus OpenXR?) version that you have installed in your project?

tenebris93 commented 1 year ago

Hi @chengnay, Sure, here is all the info on my current environment that I think might be relevant:

Package Manager Packages:

- Unity 2020.3.43f1 LFS
- Vive Input Utility v 1.17.0
- OpenXR Plugin v1.6.0
- XR Plugin Management v4.3.1

Oculus Integration v46.0

Oculus OVRPlugin is set to OpenXR

Current Installed Package Manager Assets:

image

Current VIU Settings:

image

Current XR Plug-in Management Settings:

image image

Current OpenXR Settings:

image image

Thanks again @chengnay, if you need anything else, please feel free to let me know and I will try to get that info to you.

chengnay commented 1 year ago

Hi @tenebris93, A quick fix for above issue, In OpenXRAndroidOculusSettings.cs, Change the value of OCULUS_QUEST_OPENXR_FEATURE_ID to com.unity.openxr.feature.metaquest.

If you encounter more issues, please let me know, thanks!

tenebris93 commented 1 year ago

@chengnay This seems to allow me to press the check box now. The only issue left is the crashing issue I have.

chengnay commented 1 year ago

Hi @tenebris93, What is your initial project setup when encounter the crash issue? Could you provide a sample project that can reproduce the crash issue?

tenebris93 commented 1 year ago

Hi @chengnay, Sorry for the late response. I have been busy taking care of some personal stuff. I will try to get a sample project together for you within the next day or two.

tenebris93 commented 1 year ago

Hi @chengnay, It seems I was able to reproduce the issue quicker then I thought. Here is a project you can refer to: https://github.com/tenebris93/TestingVIUCrash Simply hitting the play button in the sample scene crashes Unity.

chengnay commented 1 year ago

Hi @tenebris93, I could not reproduce the crash issue using the github you provided. Is this normal if I see this after I open the sample scene? image

tenebris93 commented 1 year ago

Hi, @chengnay Yes, the pink is normal with this specific sample project. I created it using Unity's URP sample template. It just didn't seem to import correctly. As for the crashing issue, it was crashing for me even when I did a fresh clone. I wonder what is different from my editor install that is different from yours. I will try a fresh clone on another computer in the morning to see if it happens there for me, as it is almost 2 a.m. here on the East coast of the US.

chengnay commented 1 year ago

Hi @tenebris93, It is gonna be CNY break tomorrow. I will get back to you after the break. :)

UPDATE: If you cannot reproduce the issue on your another computer, please share the editor log to me for further investigation.

tenebris93 commented 1 year ago

@chengnay The issue also happened on a different computer with a clean install. So I'm not sure why you are not receiving the issue as well, but hopefully, these logs help.

Editor_logs.zip Crashes_dump.zip

If you need anything else please just let me know.

tenebris93 commented 1 year ago

Alright, so after some more testing, I think I narrowed down what I believe is the cause. I reverted the commit titled, "Copy project settings from other project to sample project" and then discarded each file change until I came across the file that seems to cause the crash. From my testing, it looks like the changes that at some point introduced into the EditorBuildSettings.asset file is the cause.

image

The changes on the left are the changes currently in the repo that are causing the issue. The ones on the right are the changes before I copied the settings from my other project. So I think I can simply fix the issues by deleting that file and having Unity recreate it from scratch. However, it seems when I reset the file though I am unable to enable the OpenXR loader in VIU again..

tenebris93 commented 1 year ago

Upon further testing, it seems this line is the cause of the crash: com.unity.xr.management.loader_settings: {fileID: 11400000, guid: c56c329a15eba154c8d551cd32dd9571, type: 2}

All I have to do is to delete that line and I stop crashing. So it seems there is an issue with the loader settings.

tenebris93 commented 1 year ago

I tested a few things more. It seems that if I disable the OculusXR Feature for windows then I can test in the editor without it crashing.

image

So something specific with the Windows side of OpenXR is the cause.

chengnay commented 1 year ago

Hi @tenebris93. Thanks for updating the root cause. :)