Hello, fellow users!
I’m trying to switch between two different Action Maps - Player and Inventory - depending on whether the inventory is on or off. However, for some reason my movement doesn’t work when I switch back from the Inventory Action Map to the Player Action Map.
And the funny thing is: any other action from the Player Action Map works, but not the movement one. I’m not doing anything complex for the movement logic (just a simple movement using Rigidbody 2D) and debugged everything movement-related, but no success. And the WASD keys are indeed being read from the Input Debug window. ![]()
I’m using an Unity Event to call the PlayerInput Component .SwitchCurrentActionMap() method to switch between Player and Inventory Action Maps.
My Inputs are set like this:
Player
Inventory
As for my scripts, I separated my input logic from my controller logic (and to simplify, I just added a Debug.Log to my HandleMovement() method for testing purposes), so I have basically the following:
using UnityEngine;
public class PlayerMovementController : MonoBehaviour
{
[SerializeField] private Rigidbody2D rigidbody;
private Vector2 movementDirection;
private void FixedUpdate() => HandleMovement();
public void MoveTo(Vector2 direction) => movementDirection = direction;
private void HandleMovement()
{
if (movementDirection.x != 0f) Debug.Log("Move!");
}
}
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.InputSystem;
public class MovementInputReader : MonoBehaviour
{
[Title("Movement Properties")]
[SerializeField] private PlayerMovementController playerMovementController;
private InputAction movementAction;
private void OnEnable()
{
movementAction = InputSystem.actions["Move"];
movementAction.performed += OnMove;
movementAction.canceled += OnMove;
}
private void OnDisable()
{
movementAction.performed -= OnMove;
movementAction.canceled -= OnMove;
}
private void OnMove(InputAction.CallbackContext inputContext)
{
var movementDirection = inputContext.ReadValue<Vector2>();
playerMovementController.MoveTo(movementDirection);
}
}
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
public class InventoryInputReader : MonoBehaviour
{
[Title("Inventory Properties")]
[SerializeField] private PlayerInventoryController playerInventoryController;
[SerializeField] private UnityEvent OnShowInventory;
[SerializeField] private UnityEvent OnHideInventory;
private InputAction playerInventoryAction;
private InputAction inventoryAction;
private void OnEnable()
{
playerInventoryAction = InputSystem.actions["ToggleInventory"];
inventoryAction = InputSystem.actions.FindActionMap("Inventory").FindAction("Toggle");
inventoryAction.Disable();
playerInventoryAction.performed += OnToggle;
inventoryAction.performed += OnToggle;
}
private void OnDisable()
{
playerInventoryAction.performed -= OnToggle;
inventoryAction.performed -= OnToggle;
}
private void OnToggle(InputAction.CallbackContext inputContext)
{
if (playerInventoryAction.enabled)
{
OnShowInventory?.Invoke();
inventoryAction.Enable();
playerInventoryAction.Disable();
}
else
{
OnHideInventory?.Invoke();
inventoryAction.Disable();
playerInventoryAction.Enable();
}
playerInventoryController.Toggle();
}
}
I’m using Input System 1.11.1 (and using the new static class InputSystem instead of a reference to the PlayerInput Component) and Unity 2022.3.50f.
Am I doing something wrong (perhaps using something incorrectly)? Has anyone come across this situation? ![]()

