-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HMD crashes when loading a new scene #127
Comments
Hi, Does it only crash in the editor, or builds as well? |
Hi, I've this problem in the editor AND in the final builds. I have took a look at the ClientKit.cs file. It seems that the context is disposed when a scene is unloaded. https://github.com/OSVR/OSVR-Unity/blob/master/OSVR-Unity/Assets/OSVRUnity/src/ClientKit.cs#L145 The ClientKit uses the I can't test that right now, but I'll investigate this after work. Edit: I encounter the issue OSVR/OSVR-HDK-Windows-Drivers#4 when the HMD crashes. Edit 2: I have almost solved the problem. This is my OSVRManager now void Awake()
{
StartCoroutine(CheckSupport());
}
void OnLevelWasLoaded(int level)
{
StartCoroutine(CheckSupport());
}
private System.Collections.IEnumerator CheckSupport()
{
yield return new WaitForEndOfFrame();
if (GameVRSettings.HasOSVRHMDEnabled(true))
{
var camera = Camera.main;
if (camera != null)
{
if (!_clientKit.enabled)
_clientKit.enabled = true;
camera.transform.parent.gameObject.AddComponent(typeof(DisplayController));
camera.gameObject.AddComponent(typeof(VRViewer));
}
}
else
_clientKit.enabled = false;
} Now when I switch to a Level, I've this error Edit3: Added a zip file with debug output following a crash of a build. |
Well I've some news for you guys. I tried a lot of different scenarios and that's what I have founded. In my game, I was using a manager to add the So I tried something else.. I have attached these scripts to my player directly (it's not very good for now because it spams a lot the console if The second solution is better, however I still have the This is a use caseFirst test
Second test case
This is the output of the server What do you think guys? |
Thanks for the details. This may be an issue with the firmware. I'll update this thread as soon as we're able to test a firmware update (this week hopefully). |
@DuFF14 I updated the firmware of the HDK this morning, have you a changelog? |
No changes in the Unity repo, just updated RenderManager dlls. I have yet to try with the latest firmware. |
Looks like this is still an issue after 1.89 firmware upgrade. |
I can confirm that it's not yet fixed, however I think we can prevent that in the code by detecting the issue. I'm working on a refacto/fix branch, I hope it'll works ;) |
Note this occurs for me whether DirectMode is enabled or not, or when Rendermanager is used or not. Has anyone else seen these error after the USB connection drops? (Filename: Assets/OSVRUnity/src/ClientKit.cs Line: 155)
ObjectDisposedException: The object was used after being disposed.
at System.Runtime.InteropServices.SafeHandle.DangerousAddRef (System.Boolean& success) [0x0000c] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs:111
at (wrapper managed-to-native) OSVR.ClientKit.DisplayConfigNative:osvrClientCheckDisplayStartup (OSVR.ClientKit.SafeDisplayConfigHandle)
at OSVR.ClientKit.DisplayConfig.CheckDisplayStartup () [0x00000] in z:\j\workspace\Managed-OSVR\ClientKit\Display.cs:241
at OSVR.Unity.DisplayController.CheckDisplayStartup () [0x00000] in C:\Users\Greg\Documents\OSVR\Unity-VR-Samples\Assets\OSVRUnity\src\DisplayController.cs:328
at OSVR.Unity.VRViewer.OnPreCull () [0x00000] in C:\Users\Greg\Documents\OSVR\Unity-VR-Samples\Assets\OSVRUnity\src\VRViewer.cs:229
UnityEditor.EditorGUIUtility:INTERNAL_CALL_RenderGameViewCamerasInternal(Rect&, Int32, Boolean, Boolean)
UnityEditor.EditorGUIUtility:RenderGameViewCamerasInternal(Rect, Int32, Boolean, Boolean) (at C:\buildslave\unity\build\artifacts\generated\common\editor\EditorGUIUtilityBindings.gen.cs:597)
UnityEditor.GameView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GameView\GameView.cs:425)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:187)
UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:180)
UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:336)
(Filename: /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs Line: 111)
ObjectDisposedException: The object was used after being disposed.
at System.Runtime.InteropServices.SafeHandle.DangerousAddRef (System.Boolean& success) [0x0000c] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs:111
at (wrapper managed-to-native) OSVR.ClientKit.DisplayConfigNative:osvrClientCheckDisplayStartup (OSVR.ClientKit.SafeDisplayConfigHandle)
at OSVR.ClientKit.DisplayConfig.CheckDisplayStartup () [0x00000] in z:\j\workspace\Managed-OSVR\ClientKit\Display.cs:241
at OSVR.Unity.DisplayController.CheckDisplayStartup () [0x00000] in C:\Users\Greg\Documents\OSVR\Unity-VR-Samples\Assets\OSVRUnity\src\DisplayController.cs:328
at OSVR.Unity.VRViewer+<EndOfFrame>c__Iterator1.MoveNext () [0x00038] in C:\Users\Greg\Documents\OSVR\Unity-VR-Samples\Assets\OSVRUnity\src\VRViewer.cs:277
UnityEditor.EditorGUIUtility:INTERNAL_CALL_RenderGameViewCamerasInternal(Rect&, Int32, Boolean, Boolean)
UnityEditor.EditorGUIUtility:RenderGameViewCamerasInternal(Rect, Int32, Boolean, Boolean) (at C:\buildslave\unity\build\artifacts\generated\common\editor\EditorGUIUtilityBindings.gen.cs:597)
UnityEditor.GameView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GameView\GameView.cs:425)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:187)
UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:180)
UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:336) |
…dy contains a ClientKit game object would crash the hmd.
To update, the issue I was seeing were fixed by #138, but I think @demonixis is still having problems in the editor, but not in builds. |
@DuFF14 Yes I confirm that I already have random crashes with Unity, both Editor and Builds... I don't know why but I noticed one thing : I use post processes and I don't see them in the HDK (Direct Mode), do you think it can be related to that issue? |
@DuFF14 - It seems like the original issue was fixed. Can this issue be closed and open a new ticket for the other issue? If it wasn't fixed, I'm not sure what the actual issue is. Maybe splitting this into multiple tickets is the correct path? @demonixis - Could you open a new ticket with more information on your current issue? |
@chase-cobb Please do not close this issue because all errors are the same, the only difference is that I have updated the firmware of my HDK since I opened it. What do you want when you ast "More information" ? |
@demonixis I'm not suggesting we don't fix you up, but rather isolate the multiple issues discussed in this thread. This is to disambiguate, streamline discussion, and prevent this thread from being a catch-all for all bugs related to start-up and scene swapping. :) There was in fact a bug in the main code path and samples that prevented swapping scenes. This issue was fixed here -> PR #138 Your current issue seems to be more related to usage outside of the expected workflow and could be triggering another post processing issue? It would be nice to have dedicated threads and the smallest repro example project you could create. |
Same scene loading issue My config; OSVR- Unity version 0.6.8.0 with core 0.6.1176-gba5951 Any news? |
I've tested projects from @JacBellu and @demonixis, but so far haven't been able to reproduce this issue on either of my machines (GTX 960, Win 8.1 / GTX 980, Win 8.1, 364.72 Nvidia drivers). Tested on HDK 1.2, 1.3, and DK2. |
Thank you @DuFF14 for your support. What about using Nvidia drivers 364.72 instead of 362.00 as you suggested? Anyway.. I will try my project on different config |
I updated to 364.72 after this merge, which seems to have fixed that issue for me. sensics/OSVR-RenderManager#70 It looks like your renderManager dll was dated from the day before, so perhaps something else was going on. Not sure if we're out of the woods yet with that issue, but perhaps others can confirm that 364.72 drivers are now working with the latest RM build (included in OSVRUnity plugin). |
I use the old NVIDIA drivers, I'll try to update too
|
@demonixis @JacBellu there is a new PR open that addresses an issue on some systems where Unity was causing OSVR server to hang at startup (#154). Could one of you test this to see if it also fixes the scene switching bug? Only one file has changed, OsvrRenderManager.cs, so it might be easiest to just copy/paste the new file in your existing project. |
Hi, I have made new tests with the latest core + Unity SDK (pulled yesterday) and I have once again the issue. That's appears on another project so I'm a bit confused. I have used the HDK last week at my job for 5 days and I have encoutered some crashes of the server but I never loose the USB driver. So it's on my PC only and that's very strange.. My configuration
|
Hi, |
@JacBellu @demonixis is the issue still present if RenderManager extended mode is used rather than DirectMode? How about if RenderManager isn't used at all? Config file with extended mode: {
"display": "displays/OSVR_HDK_1_3.json",
"renderManagerConfig": "sample-configs/renderManager.extended.landscape.json"
} Config file with no RenderManager: {
"display": "displays/OSVR_HDK_1_3.json"
} |
I'm testing in extended mode with RenderManager while manteining the window onto my main monitor and everything works (no crash anymore). However now there is no distortion correction. (HDK 2nd display setted in Portrait mode in 1080 * 1920) |
Is there some news about this issue? |
I'm working on a single scene game so I havn't this issue. However the server crashes after many play/stop use... But that's another bug. |
@JacBellu Getting back to chasing this one. I also find no crashes when using RenderManager in extended mode, but it definitely should still have distortion correction. That doesn't change whether you're in direct mode or not, so double check your distortion in the config file. |
Hopefully this PR fixes it #163 |
Haven't encountered this or heard any reports of crashing since #163, closing this issue. |
Hi,
I encounter a serious issue with my project. First there is my setup
I've many scenes in my game, if I start the game, all works great but when I change the active scene using SceneManager, my HMD crashes, sometime Windows can't detect it and I've to unplug/plug the HDM many time to have it working again. Sometime when I change the active scene, the image in the HMD is not cleared and no more updated, however, the image on the PC screen is updated.
To support OSVR in my game I've a
gameObject
in the root scene calledClientKit
. This GO contains two scripts,ClientKit
which is enabled and a custom script,OSVRManager
, which is used to addDisplayController
to the parent's node of main camera andVRViewer
to the main camera. In fact this is my script :I don't know why it's crashing.. I hope that you can help me guys.
demonixis.
The text was updated successfully, but these errors were encountered: