StayTalm / InputSystem

An efficient and versatile input system for Unity.
1 stars 1 forks source link

If AxisControl value is accessed twice in a callback there is an InvalidOperationException #9

Closed jackpr-unity closed 6 years ago

jackpr-unity commented 6 years ago

Reproduction Steps: RiftAxisDoubleRead.zip

Expected: The slider and the adjacent text updates to the correct value.

Observed: InvalidOperationException based on modifier phases

This was found with

Notes:

My Conjecture: AxisControl.ReadValue is somehow returning by reference to a function, and when the local variable is accessed more than once the control is trying to update its phase a second time.

Stack Trace: InvalidOperationException: Cannot go from 'Performed' to 'Performed'; must be 'Waiting' or 'Started' (action: Axis, modifier: ) UnityEngine.Experimental.Input.InputAction.ThrowIfPhaseTransitionIsInvalid (Phase currentPhase, Phase newPhase, Int32 bindingIndex, Int32 modifierIndex) (at Packages/com.unity.inputsystem/InputSystem/Actions/InputAction.cs:737) UnityEngine.Experimental.Input.InputAction.ChangePhaseOfAction (Phase newPhase, UnityEngine.Experimental.Input.TriggerState& trigger) (at Packages/com.unity.inputsystem/InputSystem/Actions/InputAction.cs:570) UnityEngine.Experimental.Input.InputAction.NotifyControlValueChanged (UnityEngine.Experimental.Input.InputControl control, Int32 bindingIndex, Double time) (at Packages/com.unity.inputsystem/InputSystem/Actions/InputAction.cs:835) UnityEngine.Experimental.Input.InputManager.FireActionStateChangeNotifications (Int32 deviceIndex, Double time) (at Packages/com.unity.inputsystem/InputSystem/InputManager.cs:1982) UnityEngine.Experimental.Input.InputManager.OnUpdate (InputUpdateType updateType, Int32 eventCount, IntPtr eventData) (at Packages/com.unity.inputsystem/InputSystem/InputManager.cs:1836) UnityEngine.Experimental.Input.LowLevel.NativeInputRuntime+<>cAnonStorey0.<>m0 (NativeInputUpdateType updateType, Int32 eventCount, IntPtr eventPtr) (at Packages/com.unity.inputsystem/InputSystem/NativeInputRuntime.cs:57) UnityEngineInternal.Input.NativeInputSystem.NotifyUpdate (NativeInputUpdateType updateType, Int32 eventCount, IntPtr eventData) (at C:/Users/jackpr/Ono/unity/Modules/Input/Private/Input.cs:90) UnityEditor.EditorGUIUtility:RenderGameViewCamerasInternal_Injected(RenderTexture, Int32, Rect&, Vector2&, Boolean) UnityEditor.EditorGUIUtility:RenderGameViewCamerasInternal(RenderTexture, Int32, Rect, Vector2, Boolean) UnityEditor.GameView:OnGUI() (at C:/Users/jackpr/Ono/unity/Editor/Mono/GameView/GameView.cs:799) 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 C:/Users/jackpr/Ono/unity/Editor/Mono/HostView.cs:295) UnityEditor.HostView:Invoke(String) (at C:/Users/jackpr/Ono/unity/Editor/Mono/HostView.cs:288) UnityEditor.HostView:InvokeOnGUI(Rect) (at C:/Users/jackpr/Ono/unity/Editor/Mono/HostView.cs:255) UnityEditor.DockArea:OldOnGUI() (at C:/Users/jackpr/Ono/unity/Editor/Mono/GUI/DockArea.cs:390) UnityEngine.Experimental.UIElements.IMGUIContainer:DoOnGUI(Event, Boolean) (at C:/Users/jackpr/Ono/unity/Modules/UIElements/IMGUIContainer.cs:218) UnityEngine.Experimental.UIElements.IMGUIContainer:HandleIMGUIEvent(Event) (at C:/Users/jackpr/Ono/unity/Modules/UIElements/IMGUIContainer.cs:383) UnityEngine.Experimental.UIElements.IMGUIContainer:DoRepaint(IStylePainter) (at C:/Users/jackpr/Ono/unity/Modules/UIElements/IMGUIContainer.cs:90) UnityEngine.Experimental.UIElements.Panel:PaintSubTree(Event, VisualElement, Matrix4x4, ClippingOptions, Rect) (at C:/Users/jackpr/Ono/unity/Modules/UIElements/Panel.cs:730) UnityEngine.Experimental.UIElements.Panel:PaintSubTreeChildren(Event, VisualElement, Matrix4x4, ClippingOptions, Rect) (at C:/Users/jackpr/Ono/unity/Modules/UIElements/Panel.cs:746) UnityEngine.Experimental.UIElements.Panel:PaintSubTree(Event, VisualElement, Matrix4x4, ClippingOptions, Rect) (at C:/Users/jackpr/Ono/unity/Modules/UIElements/Panel.cs:734) UnityEngine.Experimental.UIElements.Panel:Repaint(Event) (at C:/Users/jackpr/Ono/unity/Modules/UIElements/Panel.cs:776) UnityEngine.Experimental.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) (at C:/Users/jackpr/Ono/unity/Modules/UIElements/UIElementsUtility.cs:230) UnityEngine.Experimental.UIElements.UIElementsUtility:ProcessEvent(Int32, IntPtr) (at C:/Users/jackpr/Ono/unity/Modules/UIElements/UIElementsUtility.cs:77) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/Users/jackpr/Ono/unity/Modules/IMGUI/GUIUtility.cs:171)

jackpr-unity commented 6 years ago

updated title to communicate that this does not seem to be platform specific.