Unity-Technologies / InputSystem

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

Can't remove modifier from action in Editor #6

Closed joelpryde closed 6 years ago

joelpryde commented 6 years ago

Repro:

  1. Expose an action in the editor as a property.
  2. Bind a Control to the action and add a modifier (Tap in this case).
  3. Remove the modifier.

Result: Lots of exceptions and can't remove modifier:

ArgumentNullException: Argument cannot be null. Parameter name: source System.Linq.Check.SourceAndSelector (System.Object source, System.Object selector) System.Linq.Enumerable.Select[NameAndParameters,String] (IEnumerable1 source, System.Func2 selector) ISX.Editor.InputBindingDrawer+ModifyPopupWindow.ApplyModifiers () (at Assets/InputSystem/InputSystem/Editor/InputBindingDrawer.cs:216) ISX.Editor.InputBindingDrawer+ModifyPopupWindow.m__5 (UnityEditorInternal.ReorderableList list) (at Assets/InputSystem/InputSystem/Editor/InputBindingDrawer.cs:249) UnityEditorInternal.ReorderableList+Defaults.DrawFooter (Rect rect, UnityEditorInternal.ReorderableList list) (at D:/repo/unity-isx/Editor/Mono/GUI/ReorderableList.cs:134) UnityEditorInternal.ReorderableList.DoListFooter (Rect footerRect) (at D:/repo/unity-isx/Editor/Mono/GUI/ReorderableList.cs:640) UnityEditorInternal.ReorderableList.DoList (Rect rect) (at D:/repo/unity-isx/Editor/Mono/GUI/ReorderableList.cs:412) ISX.Editor.InputBindingDrawer+ModifyPopupWindow.OnGUI (Rect rect) (at Assets/InputSystem/InputSystem/Editor/InputBindingDrawer.cs:179) UnityEditor.PopupWindow.OnGUI () (at D:/repo/unity-isx/Editor/Mono/GUI/PopupWindow.cs:92) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at D:/repo/unity-isx/Editor/Mono/HostView.cs:291) UnityEditor.HostView.Invoke (System.String methodName) (at D:/repo/unity-isx/Editor/Mono/HostView.cs:284) UnityEditor.HostView.OldOnGUI () (at D:/repo/unity-isx/Editor/Mono/HostView.cs:103) UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt) (at D:/repo/unity-isx/Modules/UIElements/IMGUIContainer.cs:203)

NullReferenceException: Object reference not set to an instance of an object ISX.Editor.InputBindingDrawer+ModifyPopupWindow.m__3 (Rect rect, Int32 index, Boolean isActive, Boolean isFocused) (at Assets/InputSystem/InputSystem/Editor/InputBindingDrawer.cs:233) UnityEditorInternal.ReorderableList.DoListElements (Rect listRect) (at D:/repo/unity-isx/Editor/Mono/GUI/ReorderableList.cs:586) UnityEditorInternal.ReorderableList.DoList (Rect rect) (at D:/repo/unity-isx/Editor/Mono/GUI/ReorderableList.cs:411) ISX.Editor.InputBindingDrawer+ModifyPopupWindow.OnGUI (Rect rect) (at Assets/InputSystem/InputSystem/Editor/InputBindingDrawer.cs:179) UnityEditor.PopupWindow.OnGUI () (at D:/repo/unity-isx/Editor/Mono/GUI/PopupWindow.cs:92) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at D:/repo/unity-isx/Editor/Mono/HostView.cs:291) UnityEditor.HostView.Invoke (System.String methodName) (at D:/repo/unity-isx/Editor/Mono/HostView.cs:284) UnityEditor.HostView.OldOnGUI () (at D:/repo/unity-isx/Editor/Mono/HostView.cs:103) UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt) (at D:/repo/unity-isx/Modules/UIElements/IMGUIContainer.cs:203) UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) UnityEngine.Experimental.UIElements.IMGUIContainer:DoOnGUI(Event) (at D:/repo/unity-isx/Modules/UIElements/IMGUIContainer.cs:214) UnityEngine.Experimental.UIElements.IMGUIContainer:HandleIMGUIEvent(Event) (at D:/repo/unity-isx/Modules/UIElements/IMGUIContainer.cs:355) UnityEngine.Experimental.UIElements.IMGUIContainer:HandleEvent(EventBase) (at D:/repo/unity-isx/Modules/UIElements/IMGUIContainer.cs:342) UnityEngine.Experimental.UIElements.EventDispatcher:PropagateEvent(EventBase) (at D:/repo/unity-isx/Modules/UIElements/EventDispatcher.cs:451) UnityEngine.Experimental.UIElements.EventDispatcher:DispatchEvent(EventBase, IPanel) (at D:/repo/unity-isx/Modules/UIElements/EventDispatcher.cs:322) UnityEngine.Experimental.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) (at D:/repo/unity-isx/Modules/UIElements/UIElementsUtility.cs:219) UnityEngine.Experimental.UIElements.UIElementsUtility:ProcessEvent(Int32, IntPtr) (at D:/repo/unity-isx/Modules/UIElements/UIElementsUtility.cs:77) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at D:/repo/unity-isx/Modules/IMGUI/GUIUtility.cs:184)

Rene-Damm commented 6 years ago

Fixed in https://github.com/Unity-Technologies/InputSystem/commit/a7681e33a515fa5aa0a465df7cf2b3332a364984.