Here is my code for switching input action assets
_newActionAssets.Enable();
_playerInput.enabled = false;
_playerInput.defaultActionMap = "Standalone_EOperationMode.GamePlay";
_playerInput.actions = _newActionAssets;
_playerInput.actions.Enable();
_playerInput.enabled = true;
However, when this code is called and the corresponding input is pressed, 2 errors occurs as follows:
This is the first error message:
KeyNotFoundException: The given key ‘7e631a94-e6ef-4de2-a848-a82e8bf9b27c’ was not present in the dictionary.
System.Collections.Generic.Dictionary2[TKey,TValue].get_Item (TKey key) (at <694551e795764b938030a3128fac2b36>:0)* *UnityEngine.InputSystem.PlayerInput.OnActionTriggered (UnityEngine.InputSystem.InputAction+CallbackContext context) (at Library/PackageCache/com.unity.inputsystem@1.7.0/InputSystem/Plugins/PlayerInput/PlayerInput.cs:1335)* *UnityEngine.InputSystem.Utilities.DelegateHelpers.InvokeCallbacksSafe[TValue] (UnityEngine.InputSystem.Utilities.CallbackArray1[System.Action`1[TValue]]& callbacks, TValue argument, System.String callbackName, System.Object context) (at Library/PackageCache/com.unity.inputsystem@1.7.0/InputSystem/Utilities/DelegateHelpers.cs:46)
UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer)*
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)
and the second error message:
KeyNotFoundException while executing ‘performed’ callbacks of ‘TempDefaultKeyInputConfig (UnityEngine.InputSystem.InputActionAsset):Standalone_EOperationMode.GamePlay’
UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass7_0:<set_onUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer)*
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr)
How should I properly switch input action assets, and what could be causing this issue?
Is it due to some references or callbacks not being correctly cleared, or is there another reason?
Thanks.