New Input System: ArgumentException: Event must be a state or delta state event

Hi everyone. I’m making a simple Android game using New Input System and OnScreen controls.
Build works fine until i reload the game scene. At this moment controls stop working. After getting back to menu scene and trying to reload game scene one more time the game freezes and crashes. This is what is shown when controls stop responding:

2021.01.10 20:36:37.830 28265 28308 Error Unity ArgumentException: Event must be a state or delta state event
2021.01.10 20:36:37.830 28265 28308 Error Unity Parameter name: eventPtr
2021.01.10 20:36:37.830 28265 28308 Error Unity   at UnityEngine.InputSystem.InputControlExtensions.GetStatePtrFromStateEvent (UnityEngine.InputSystem.InputControl control, UnityEngine.InputSystem.LowLevel.InputEventPtr eventPtr) [0x00075] in <4f1d7098b570438ca553c2258f76742d>:0 
2021.01.10 20:36:37.830 28265 28308 Error Unity   at UnityEngine.InputSystem.InputControlExtensions.WriteValueIntoEvent[TValue] (UnityEngine.InputSystem.InputControl`1[TValue] control, TValue value, UnityEngine.InputSystem.LowLevel.InputEventPtr eventPtr) [0x00022] in <4f1d7098b570438ca553c2258f76742d>:0 
2021.01.10 20:36:37.830 28265 28308 Error Unity   at UnityEngine.InputSystem.OnScreen.OnScreenControl.SendValueToControl[TValue] (TValue value) [0x00089] in <4f1d7098b570438ca553c2258f76742d>:0 
2021.01.10 20:36:37.830 28265 28308 Error Unity   at UnityEngine.InputSystem.OnScreen.OnScreenButton.OnPointerDown (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in <4f1d7098b570438ca553c2258f76742d>:0 
2021.01.10 20:36:37.830 28265 28308 Error Unity   at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerDownHandler handler, UnityEngine.EventS

And that is a part of crashing log:

0001.01.01 00:00:00.000 -1 -1 Info  --------- beginning of crash
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime FATAL EXCEPTION: UnityMain
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime Process: com.DefaultCompany.com.unity.template.mobile2D, PID: 28265
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime Version '2019.4.13f1 (518737b1de84)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a'
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime Build fingerprint: 'xiaomi/whyred/whyred:9/PKQ1.180904.001/V11.0.3.0.PEIMIXM:user/release-keys'
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime Revision: '0'
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime ABI: 'arm'
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime Timestamp: 2021-01-10 20:37:06+0300
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime pid: 28265, tid: 28308, name: UnityMain  >>> com.DefaultCompany.com.unity.template.mobile2D <<<
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime uid: 10156
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x83e00158
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime     r0  83e0011c  r1  00000047  r2  00000003  r3  00000000
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime     r4  ecf134cc  r5  83e4a864  r6  dd8a2000  r7  00000000
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime     r8  ddceb988  r9  ecf133bc  r10 00000002  r11 83e4a864
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime     ip  ecf13cfc  sp  ce2fe840  lr  ecee6ba9  pc  ecee6734
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime 

I attach the log file with the full information. Seems like a huge problem with New Input System
[173990-comdefaultcompanycomunitytemplatemobile2d-logcat.txt|173990]

,Hi everyone and sorry for a lot of log text. I’m making a simple Android game using new input system and OnScreen controls. The problem is that when i start the game on the device and reload a game scene the controls stop working. Returning back to menu scene and trying to load game scene one more time results in freezing and crashing. That is what was showing in Android Logcat when I was pressing OnScreen buttons:

2021.01.10 20:16:12.712 26578 26623 Error Unity ArgumentException: Event must be a state or delta state event
2021.01.10 20:16:12.712 26578 26623 Error Unity Parameter name: eventPtr
2021.01.10 20:16:12.712 26578 26623 Error Unity   at UnityEngine.InputSystem.InputControlExtensions.GetStatePtrFromStateEvent (UnityEngine.InputSystem.InputControl control, UnityEngine.InputSystem.LowLevel.InputEventPtr eventPtr) [0x00075] in <b13c46b9cbb648928a28297ab6513fa1>:0 
2021.01.10 20:16:12.712 26578 26623 Error Unity   at UnityEngine.InputSystem.InputControlExtensions.WriteValueIntoEvent[TValue] (UnityEngine.InputSystem.InputControl`1[TValue] control, TValue value, UnityEngine.InputSystem.LowLevel.InputEventPtr eventPtr) [0x00022] in <b13c46b9cbb648928a28297ab6513fa1>:0 
2021.01.10 20:16:12.712 26578 26623 Error Unity   at UnityEngine.InputSystem.OnScreen.OnScreenControl.SendValueToControl[TValue] (TValue value) [0x00089] in <b13c46b9cbb648928a28297ab6513fa1>:0 
2021.01.10 20:16:12.712 26578 26623 Error Unity   at UnityEngine.InputSystem.OnScreen.OnScreenButton.OnPointerUp (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in <b13c46b9cbb648928a28297ab6513fa1>:0 
2021.01.10 20:16:12.712 26578 26623 Error Unity   at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerUpHandler handler, UnityEngine.EventSyste

And that is a part of the crashing log:

0001.01.01 00:00:00.000 -1 -1 Info  --------- beginning of crash
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime FATAL EXCEPTION: UnityMain
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime Process: com.DefaultCompany.com.unity.template.mobile2D, PID: 28265
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime Version '2019.4.13f1 (518737b1de84)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a'
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime Build fingerprint: 'xiaomi/whyred/whyred:9/PKQ1.180904.001/V11.0.3.0.PEIMIXM:user/release-keys'
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime Revision: '0'
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime ABI: 'arm'
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime Timestamp: 2021-01-10 20:37:06+0300
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime pid: 28265, tid: 28308, name: UnityMain  >>> com.DefaultCompany.com.unity.template.mobile2D <<<
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime uid: 10156
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x83e00158
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime     r0  83e0011c  r1  00000047  r2  00000003  r3  00000000
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime     r4  ecf134cc  r5  83e4a864  r6  dd8a2000  r7  00000000
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime     r8  ddceb988  r9  ecf133bc  r10 00000002  r11 83e4a864
2021.01.10 20:37:06.622 28265 28308 Error AndroidRuntime     ip  ecf13cfc  sp  ce2fe840  lr  ecee6ba9  pc  ecee6734

There is also info about the moment of freezing. I attach the log file with the complete information. Seems like a huge problem with new input system.[173990-comdefaultcompanycomunitytemplatemobile2d-logcat.txt|173990]

Any updates about this issue?
I am running right into it today and I’ve found no other post speaking about this…

I was having the same problems with it crashing and not having controls. I tracked it down to the OnDisable method in OnScreenControl. These lines specifically:

// We're the last on-screen control on this device. Remove the device.
                    s_OnScreenDevices*.Destroy();*

s_OnScreenDevices.RemoveAt(i);
I commented out the RemoveAt(i) because that is most likely causing the root IndexOutOfBoundsException that would later set up for the crashing and no input. Because you don’t want to possibly reference a destroyed object, I also commented the Destroy line out. I believe that these lines do some cleanup of the components, but then once no controls are active anymore, it destroys the screen device, preventing others from functioning.
Did you happen to have multiple Canvas objects in the scene? I do, and thought it might be a contributing factor, but could never find anything conclusive.
I’m sure commenting out these lines will cause a problem somewhere. Probably a memory leak of some sort. But for now it at least lets me continue working.
It looks like your problem is similar, and might have a similar solution in another method?

For anyone who might be interested… I update input system to 1.3 and it gets fixed.