Unity-Technologies / InputSystem

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

Input Actions: Unity fails to immediately delete duplicated actions, reaching "out of bounds" for array elements #795

Closed HeyItsLollie closed 4 years ago

HeyItsLollie commented 5 years ago

Present in 0.9.3, related to #794 (Windows 10, 64-bit. Unity 2019.2.0f1)

Perform the Duplicate bug in #794: Create a new Input Actions file, with two or more actions. (Bindings are not required) Select two or more actions, then right-click > Duplicate.

Then, WITHOUT clearing your selection, right-click > Delete.

Unity should then fail to delete the selection, and return the below error in Console.

ArgumentException: No action with ID 9f92476f-f443-4d08-a3cc-986b88443740 in m_ActionMaps.Array.data[0] (ID will be different)

Once this error appears, try selecting duplicated actions at the very bottom of the Actions list. Unity should return three more sets of errors in console. The number of entries that return the errors below, is directly related to the number of actions that were selected for duplication.


UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

SerializedProperty m_ActionMaps.Array.data[0].m_Actions.Array.data[19] has disappeared!
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.InputSystem.Editor.InputActionPropertiesView..ctor (UnityEditor.SerializedProperty actionProperty, System.Action`1[T] onChange) (at Library/PackageCache/com.unity.inputsystem@0.9.3-preview/InputSystem/Editor/AssetEditor/InputActionPropertiesView.cs:22)
UnityEngine.InputSystem.Editor.InputActionEditorWindow.LoadPropertiesForSelection () (at Library/PackageCache/com.unity.inputsystem@0.9.3-preview/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs:499)
UnityEngine.InputSystem.Editor.InputActionEditorWindow.OnActionTreeSelectionChanged () (at Library/PackageCache/com.unity.inputsystem@0.9.3-preview/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs:423)
UnityEngine.InputSystem.Editor.InputActionTreeView.SelectionChanged (System.Collections.Generic.IList`1[T] selectedIds) (at Library/PackageCache/com.unity.inputsystem@0.9.3-preview/InputSystem/Editor/AssetEditor/InputActionTreeView.cs:359)
UnityEditor.IMGUI.Controls.TreeViewController.NotifyListenersThatSelectionChanged () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:442)
UnityEditor.IMGUI.Controls.TreeViewController.NewSelectionFromUserInteraction (System.Collections.Generic.List`1[T] newSelection, System.Int32 itemID) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:1201)
UnityEditor.IMGUI.Controls.TreeViewController.SelectionClick (UnityEditor.IMGUI.Controls.TreeViewItem itemClicked, System.Boolean keepMultiSelection) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:1190)
UnityEditor.IMGUI.Controls.TreeViewController.HandleUnusedMouseEventsForItem (UnityEngine.Rect rect, UnityEditor.IMGUI.Controls.TreeViewItem item, System.Int32 row) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:404)
UnityEditor.IMGUI.Controls.TreeViewController.DoItemGUI (UnityEditor.IMGUI.Controls.TreeViewItem item, System.Int32 row, System.Single rowWidth, System.Boolean hasFocus) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:507)
UnityEditor.IMGUI.Controls.TreeViewController.IterateVisibleItems (System.Int32 firstRow, System.Int32 numVisibleRows, System.Single rowWidth, System.Boolean hasFocus) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:691)
UnityEditor.IMGUI.Controls.TreeViewController.OnGUI (UnityEngine.Rect rect, System.Int32 keyboardControlID) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:594)
UnityEditor.IMGUI.Controls.TreeView.OnGUI (UnityEngine.Rect rect) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControl.cs:414)
UnityEngine.InputSystem.Editor.InputActionTreeView.OnGUI (UnityEngine.Rect rect) (at Library/PackageCache/com.unity.inputsystem@0.9.3-preview/InputSystem/Editor/AssetEditor/InputActionTreeView.cs:1058)
UnityEngine.InputSystem.Editor.InputActionEditorWindow.DrawColumnWithTreeView (UnityEditor.IMGUI.Controls.TreeView treeView, System.Single width, System.Boolean fixedWidth) (at Library/PackageCache/com.unity.inputsystem@0.9.3-preview/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs:630)
UnityEngine.InputSystem.Editor.InputActionEditorWindow.DrawActionsColumn (System.Single width) (at Library/PackageCache/com.unity.inputsystem@0.9.3-preview/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs:617)
UnityEngine.InputSystem.Editor.InputActionEditorWindow.OnGUI () (at Library/PackageCache/com.unity.inputsystem@0.9.3-preview/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs:588)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <a8ed250850854b439cedc18931a314fe>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <a8ed250850854b439cedc18931a314fe>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <a8ed250850854b439cedc18931a314fe>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:359)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:353)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:329)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:374)
UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:341)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:298)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:483)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:466)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:447)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/Events/MouseCaptureDispatchingStrategy.cs:93)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:280)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:156)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:190)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:255)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)```
Rene-Damm commented 5 years ago

We need to ensure that duplicating actions this way is disabled in the editor. The subassets on the .inputactions file aren't the real actions but rather reference objects that point to the real actions. For all intents and purposes, the asset should be considered immutable except through modifications directly on the .inputactions file. Bit of an unfortunate side-effect of the fact that these files are JSON-serialized data and not native Unity data.

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!