Closed MiPa12 closed 2 years ago
@MiPa12 , thanks for the feedback. The issue you are reporting is Unity specific challenge, and probably better to report on this GitHub repo, which is also monitored by our team: https://github.com/microsoft/OpenXR-Unity-MixedReality-Samples
From the error message, this is likely an issue in Unity's Input system. I admit we've not tested with the scenario as you said. So it will be better reported to Unity team through Unity's bug or Unity's Forum.
This is the error message that seems to matter:
Could not recreate input device 'HP HP Reverb G2 Controller OpenXR (XRInputV1)' with layout 'XRInputV1::HP::HPReverbG2ControllerOpenXR' and variants 'Default' after domain reload UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>cDisplayClass7_0:
b 0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*) UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr) UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes (System.Type[])
I wonder if you have a Unity project that can reproduce this issue to share? It might help us or Unity team to investigate. We will also reach out to Unity team to see if they have insights.
@MiPa12 ,
Could you double check what is the "Input System" package you are using? There are some related bugs fixed in latest version, so worth to try our project again with upgrading input system package to 1.2.0
@MiPa12 I hope the latest Unity input system package solved the problem for you. If not please reactive this issue and let us know what we can help further.
Describe the bug
Hi, I need to switch between mulitple devices during runtime (Desktop, HP Reverb G2 and Hololens 2). Currently, I'm working on the device switch between Desktop and VR. When I disable XR with StopXR() and try to enable it afterwards with StartXR(), then I'm not able to provide Inputs to the motion controllers anymore. The headset is working fine, I'm able to see the controllers but an input is not possible anymore. If there is any ohter way to do this, I would be happy about any advice.
For this I'm using the following code:
I'm looking for something like InputSystem.RemoveDevice(inputDevice) and InputSystem.AddDevice(inputDevice).
Error message
After calling StartXR() (before that StopXR() was executed once) , then I stopped unity and after running unity again the follwing error occurs and inputs to the controller,which are implemented by the new input system, are not possible anymore:
Could not recreate input device 'HP HP Reverb G2 Controller OpenXR (XRInputV1)' with layout 'XRInputV1::HP::HPReverbG2ControllerOpenXR' and variants 'Default' after domain reload UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>cDisplayClass7_0:b 0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes (System.Type[])
InvalidOperationException: Cannot find parent 'devicepose' of control 'devicepose/istracked' in layout 'XRInputV1::HP::HPReverbG2ControllerOpenXR' UnityEngine.InputSystem.Layouts.InputDeviceBuilder.InsertChildControl (UnityEngine.InputSystem.Layouts.InputControlLayout layout, UnityEngine.InputSystem.Utilities.InternedString variant, UnityEngine.InputSystem.InputControl parent, System.Boolean& haveChildrenUsingStateFromOtherControls, UnityEngine.InputSystem.Layouts.InputControlLayout+ControlItem& controlItem) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/Devices/InputDeviceBuilder.cs:557) UnityEngine.InputSystem.Layouts.InputDeviceBuilder.AddChildControlIfMissing (UnityEngine.InputSystem.Layouts.InputControlLayout layout, UnityEngine.InputSystem.Utilities.InternedString variants, UnityEngine.InputSystem.InputControl parent, System.Boolean& haveChildrenUsingStateFromOtherControls, UnityEngine.InputSystem.Layouts.InputControlLayout+ControlItem& controlItem) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/Devices/InputDeviceBuilder.cs:508) UnityEngine.InputSystem.Layouts.InputDeviceBuilder.AddChildControls (UnityEngine.InputSystem.Layouts.InputControlLayout layout, UnityEngine.InputSystem.Utilities.InternedString variants, UnityEngine.InputSystem.InputControl parent, System.Boolean& haveChildrenUsingStateFromOtherControls) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/Devices/InputDeviceBuilder.cs:337) UnityEngine.InputSystem.Layouts.InputDeviceBuilder.InstantiateLayout (UnityEngine.InputSystem.Layouts.InputControlLayout layout, UnityEngine.InputSystem.Utilities.InternedString variants, UnityEngine.InputSystem.Utilities.InternedString name, UnityEngine.InputSystem.InputControl parent) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/Devices/InputDeviceBuilder.cs:193) UnityEngine.InputSystem.Layouts.InputDeviceBuilder.InstantiateLayout (UnityEngine.InputSystem.Utilities.InternedString layout, UnityEngine.InputSystem.Utilities.InternedString variants, UnityEngine.InputSystem.Utilities.InternedString name, UnityEngine.InputSystem.InputControl parent) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/Devices/InputDeviceBuilder.cs:102) UnityEngine.InputSystem.Layouts.InputDeviceBuilder.Setup (UnityEngine.InputSystem.Utilities.InternedString layout, UnityEngine.InputSystem.Utilities.InternedString variants, UnityEngine.InputSystem.Layouts.InputDeviceDescription deviceDescription) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/Devices/InputDeviceBuilder.cs:51) UnityEngine.InputSystem.InputDevice.Build[TDevice] (System.String layoutName, System.String layoutVariants, UnityEngine.InputSystem.Layouts.InputDeviceDescription deviceDescription) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/Devices/InputDevice.cs:678) UnityEngine.InputSystem.InputManager.AddDevice (UnityEngine.InputSystem.Utilities.InternedString layout, System.Int32 deviceId, System.String deviceName, UnityEngine.InputSystem.Layouts.InputDeviceDescription deviceDescription, UnityEngine.InputSystem.InputDevice+DeviceFlags deviceFlags, UnityEngine.InputSystem.Utilities.InternedString variants) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/InputManager.cs:1033) UnityEngine.InputSystem.InputManager.RestoreDeviceFromSavedState (UnityEngine.InputSystem.InputManager+DeviceState& deviceState, UnityEngine.InputSystem.Utilities.InternedString layout) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/InputManager.cs:3420) UnityEngine.InputSystem.LowLevel.<>cDisplayClass7_0:b 0(NativeInputUpdateType, NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)
UnityEngineInternal.Input.NativeInputSystem:Update(NativeInputUpdateType)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])
Furthermore, when I enable/disable XR multiple times I got multiple Instances of those devices as depicted in the image below. When I stop Unity and run Unity again those device duplicates stay. I need to restart unity or remove those device duplicates manually to get it work again:
Expected Behavior
run Unity:
stop Unity:
To reproduce
Steps to reproduce the behavior:
Your setup (please complete the following information)
Target platform (please complete the following information)
Thanks.