Good night, I want to understand how the workflow of action maps work, from my understanding after some time reading was that: You define contexts for your input, one for the inventory and another for controlling the player for example, I understand that (everything’s changing so fast), but I can’t get it to work.
When I change from the Player action map to the UI action map with
playerInput.SwitchCurrentActionMap ("UI");
Everything works fine, it doesn’t call any actions from the Player map anymore, but when I switch back and call an action with the same binding as my UI (e.g., dpad for moving the player, and the same dpad for navigating on the UI, in a different action map), it throws a Should Not Get Here exception, but the player actions are working normally.
Should not get here
UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer*) (at ?)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr) (at C:/buildslave/unity/build/Modules/Input/Private/Input.cs:120)
I’m also running into errors when switching maps on 1.0.0 preview.4
I’m get a “Control index is out of range” when switching from UI to Player using a PlayerInput component sending C# Events, and switching action maps in the same way as Yemnefer.
I also get 5 “Should not get here” errors whenever I exit play mode.
Here’s the sample project, easily reproducible in a new Unity Project. (2019.2.19f1) (1.0.0-preview.4)
With the sample project:
Open the Sample Scene.
Perform the Move Action (default: left stick), check the console.
Perform the Start Action (default: start), the inventory opens and the action map is changed (Player > UI).
Press start, the action map is changed again (UI > Player)
Perform the Move Action (Should Not Get Here Exception is being thrown along with the logs), the Fire Action (a player map only) doesn’t throw anything.
In A new Unity Project
In a new Unity project, Add a Player Input Component (not sure if the player input is part of the problem).
Create an Input Action Asset and two actions maps.
Give both action maps an action with same keybindings.
Switch from the default map to the other, then switch back, Should Not Get Here here is being thrown when performing that action.
Problem turned out to be that the code didn’t properly deal with some piece of code enabling only specific actions and another enabling entire action maps. The former is done by InputSystemUIInputModule on the “UI” action map whereas the latter is done by PlayerInput.
////EDIT: Fix unfortunately didn’t make it in time for 1.0.0-preview.5 (QA already concluded and fix is too intrusive to sneak it in) but will be in next package.
randomly pops up for me again with 1.0.0 final. logs the (potentially) error pausing ‘control index out of range’ error even earlier and every second time when using PlayerInput.actions.Disable()/Enable()