Unity-Technologies / InputSystem

An efficient and versatile input system for Unity.
Other
1.43k stars 312 forks source link

NotImplementedException when clicking on the binding path dropdown #871

Closed danjlewis closed 4 years ago

danjlewis commented 5 years ago

When I click on this dropdown (see below) I get a console error saying NotImplementedException: The method or operation is not implemented. and nothing else happens. image

Rallix commented 5 years ago

For me, there's a NotImplementedException when I try to add a device in Project Settings > Input System Package > Supported Devices > (+) Choose to add to list:

NotImplementedException: The method or operation is not implemented.
UnityEngine.InputSystem.Utilities.PrimitiveValue.FromString (System.String value) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Utilities/PrimitiveValue.cs:407)
UnityEngine.InputSystem.Utilities.NamedValue.ParseParameter (System.String parameterString, System.Int32& index) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Utilities/NamedValue.cs:157)
UnityEngine.InputSystem.Utilities.NamedValue.ParseMultiple (System.String parameterString) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Utilities/NamedValue.cs:98)
UnityEngine.InputSystem.Layouts.InputControlLayout+Builder+ControlBuilder.WithParameters (System.String parameters) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Controls/InputControlLayout.cs:666)
UnityEngine.InputSystem.HID.HID+HIDLayoutBuilder.Build () (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Plugins/HID/HID.cs:375)
UnityEngine.InputSystem.HID.HID+<>c__DisplayClass12_0.<OnFindLayoutForDevice>b__0 () (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Plugins/HID/HID.cs:185)
UnityEngine.InputSystem.Layouts.InputControlLayout+Collection.TryLoadLayoutInternal (UnityEngine.InputSystem.Utilities.InternedString name) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Controls/InputControlLayout.cs:1811)
UnityEngine.InputSystem.Layouts.InputControlLayout+Collection.TryLoadLayout (UnityEngine.InputSystem.Utilities.InternedString name, System.Collections.Generic.Dictionary`2[TKey,TValue] table) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Controls/InputControlLayout.cs:1822)
UnityEngine.InputSystem.Layouts.InputControlLayout+Cache.FindOrLoadLayout (System.String name) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Controls/InputControlLayout.cs:2023)
UnityEngine.InputSystem.Editor.EditorInputControlLayoutCache.Refresh () (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/EditorInputControlLayoutCache.cs:235)
UnityEngine.InputSystem.Editor.EditorInputControlLayoutCache.get_allLayouts () (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/EditorInputControlLayoutCache.cs:30)
UnityEngine.InputSystem.Editor.InputControlPickerDropdown.AddItemsForDevices (UnityEngine.InputSystem.Editor.AdvancedDropdownItem parent) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/ControlPicker/InputControlPickerDropdown.cs:128)
UnityEngine.InputSystem.Editor.InputControlPickerDropdown.BuildRoot () (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/ControlPicker/InputControlPickerDropdown.cs:76)
UnityEngine.InputSystem.Editor.CallbackDataSource.FetchData () (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/Internal/AdvancedDropdown/CallbackDataSource.cs:22)
UnityEngine.InputSystem.Editor.AdvancedDropdownDataSource.ReloadData () (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/Internal/AdvancedDropdown/AdvancedDropdownDataSource.cs:21)
UnityEngine.InputSystem.Editor.AdvancedDropdownWindow.OnDirtyList () (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/Internal/AdvancedDropdown/AdvancedDropdownWindow.cs:292)
UnityEngine.InputSystem.Editor.AdvancedDropdownWindow.Init (UnityEngine.Rect buttonRect) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/Internal/AdvancedDropdown/AdvancedDropdownWindow.cs:151)
UnityEngine.InputSystem.Editor.AdvancedDropdown.Show (UnityEngine.Rect rect) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/Internal/AdvancedDropdown/AdvancedDropdown.cs:48)
UnityEngine.InputSystem.Editor.InputSettingsProvider+<>c__DisplayClass10_0.<InitializeWithCurrentSettings>b__2 (UnityEngine.Rect rect, UnityEditorInternal.ReorderableList list) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/Settings/InputSettingsProvider.cs:267)
UnityEditorInternal.ReorderableList+Defaults.DrawFooter (UnityEngine.Rect rect, UnityEditorInternal.ReorderableList list) (at <52c46852ed4749ed926125cda2005635>:0)
UnityEditorInternal.ReorderableList.DoListFooter (UnityEngine.Rect footerRect) (at <52c46852ed4749ed926125cda2005635>:0)
UnityEditorInternal.ReorderableList.DoLayoutList () (at <52c46852ed4749ed926125cda2005635>:0)
UnityEngine.InputSystem.Editor.InputSettingsProvider.OnGUI (System.String searchContext) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview/InputSystem/Editor/Settings/InputSettingsProvider.cs:114)
UnityEditor.SettingsWindow.DrawControls () (at <52c46852ed4749ed926125cda2005635>:0)
UnityEditor.SettingsWindow.DrawSettingsPanel () (at <52c46852ed4749ed926125cda2005635>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Boolean eventIsPropagatedFromNonFocusableVisualElement) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean eventIsPropagatedFromNonFocusableVisualElement) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean eventIsPropagatedFromNonFocusableVisualElement) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <afbdfd007ccb47e98566943b0715a4f7>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <ede85b10691a411faa239e6306258393>:0)
Rene-Damm commented 5 years ago

We will need more information to act on this one.

@pikzelgames Could you file a bug through the Unity bug reporter and paste the full log message (including the stack trace)? Would like to see whether it's coming from the same place that @tomas-jezek is seeing.

@tomas-jezek I assume that's related to #902? From the looks, though, other than fixing the exception in the HID code, we should add some protection so that the layout crawling code will continue even if one particular layout won't load correctly. Added a TODO.

Rallix commented 5 years ago

@Rene-Damm Could be. I don't really know, I'm sorry. I had the virtual joystick app installed since forever, but these errors only started appearing ever since I updated to the new 2019 beta versions and/or input system 1.0.0.

I haven't been keeping up with the package's development over the summer, so I can't pinpoint the exact version/change which might have caused it. I didn't have either of these issues back in June when I posted here, but that's a while back.

Preventing the package from stopping working when a layout seems unavailable looks like a good idea, though; thank you.

MellowArpeggiation commented 5 years ago

@Rene-Damm I've done some stepping through where the error is occurring, and it definitely happens when a device is reporting an input with a report size of 32 bits. There are a few locations where a bit shift is applied against this report size (1 << 32), which causes the compiler to give us undefined results. Some custom vJoy devices report this size (in my case, Gamecube controllers)

The struct HIDElementDescriptor does this shift in minFloatValue, maxFloatValue, and in the method DetermineDefaultState(). This causes minFloatValue to return NaN and maxFloatValue to return Infinity (at least on my machine, since it is undefined behaviour it could do anything).

If I can determine a good way to handle this large report size I'll make a patch (but I'm at work at the moment!), might just be for now we drop those devices so we can function on the remaining ones?

Edit: It looks like changing the line: var maxValue = (1 << reportSizeInBits) - 1; to var maxValue = ((long) 1 << reportSizeInBits) - 1; might be a valid solution here, but I'm not able to test properly.

stefanunity commented 4 years ago

Hello,

we're going to close all the github issues and will concentrate bug information in the Unity public issue tracker https://issuetracker.unity3d.com/product/unity/issues?project=116&status=1&unity_version=&view=hottest.

If you are still experienceing this issue in the latest package version please do file a bug report as described here https://unity3d.com/unity/qa/bug-reporting For general feedback and discussions you can go to https://forum.unity.com/forums/new-input-system.103/

Thank you!