Unity-Technologies / InputSystem

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

Hitting "Apply" in .inputactions inspector leads to errors #46

Closed Rene-Damm closed 6 years ago

Rene-Damm commented 6 years ago

UI gets corrupted (importer section disappears) and lots of exceptions logged to console. Some are InvalidOperationExceptions from ReadOnlyArray:

InvalidOperationException: Operation is not valid due to the current state of the object ISX.Utilities.ReadOnlyArray1[ISX.InputBinding].get_Item (Int32 index) (at Packages/com.unity.inputsystem/InputSystem/Utilities/ReadOnlyArray.cs:94) ISX.InputActionSet+ActionJson.FromAction (ISX.InputAction action) (at Packages/com.unity.inputsystem/InputSystem/Actions/InputActionSet.cs:626) ISX.InputActionSet+ActionFileJson.FromSets (IEnumerable1 sets) (at Packages/com.unity.inputsystem/InputSystem/Actions/InputActionSet.cs:774) ISX.InputActionSet.ToJson (IEnumerable`1 sets) (at Packages/com.unity.inputsystem/InputSystem/Actions/InputActionSet.cs:799) ISX.InputActionAsset.ToJson () (at Packages/com.unity.inputsystem/InputSystem/Actions/InputActionAsset.cs:31) ISX.Editor.InputActionImporterEditor.OnInspectorGUI () (at Packages/com.unity.inputsystem/InputSystem/Editor/InputActionImporterEditor.cs:108) UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at X:/Unity/trunk/Editor/Mono/Inspector/InspectorWindow.cs:1364) UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) UnityEditor.InspectorWindow:DrawEditor(Editor[], Int32, Boolean, Boolean&, Rect&) (at X:/Unity/trunk/Editor/Mono/Inspector/InspectorWindow.cs:1371) UnityEditor.InspectorWindow:DrawEditors(Editor[]) (at X:/Unity/trunk/Editor/Mono/Inspector/InspectorWindow.cs:1138) UnityEditor.InspectorWindow:OnGUI() (at X:/Unity/trunk/Editor/Mono/Inspector/InspectorWindow.cs:478) System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&) System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.HostView:Invoke(String, Object) (at X:/Unity/trunk/Editor/Mono/HostView.cs:295) UnityEditor.HostView:Invoke(String) (at X:/Unity/trunk/Editor/Mono/HostView.cs:288) UnityEditor.HostView:InvokeOnGUI(Rect) (at X:/Unity/trunk/Editor/Mono/HostView.cs:255) UnityEditor.DockArea:OldOnGUI() (at X:/Unity/trunk/Editor/Mono/GUI/DockArea.cs:386) UnityEngine.Experimental.UIElements.IMGUIContainer:DoOnGUI(Event) (at X:/Unity/trunk/Modules/UIElements/IMGUIContainer.cs:199) UnityEngine.Experimental.UIElements.IMGUIContainer:HandleIMGUIEvent(Event) (at X:/Unity/trunk/Modules/UIElements/IMGUIContainer.cs:364) UnityEngine.Experimental.UIElements.IMGUIContainer:DoRepaint(IStylePainter) (at X:/Unity/trunk/Modules/UIElements/IMGUIContainer.cs:72) UnityEngine.Experimental.UIElements.Panel:PaintSubTree(Event, VisualElement, Matrix4x4, ClippingOptions, Rect) (at X:/Unity/trunk/Modules/UIElements/Panel.cs:726)

Rene-Damm commented 6 years ago

A reimport of the asset gets rid of the broken state. Seems that the asset the importer is holding on to is in a half-initialized state and some of the bindings arrays aren't put in place.

Rene-Damm commented 6 years ago

Fixed as of 86d163df5f5985ecd3958919d271f42243b747aa.