I am running into an issue where switching from a “Menu” action map to a “Game” action map is requiring the player to release a button that is shared between the two maps. Both my menu “Select” action and vehicle “Accelerate” action are mapped to the same button (Button South). When the player resumes the game with the Select action, the Accelerate action is ignored until the player releases and re-presses the button.
Is there any way to get the Accelerate action to become active immediately after switching action maps?
Here’s some code showing what I am trying to accomplish:
public class Player : MonoBehaviour
{
public PlayerInput playerInput;
private void Update()
{
// Action map is set to "Menu" by default
if (playerInput.actions["Select"].ReadValue<float>() > 0f) // This action is on the "Menu" action map
{
print("Select");
playerInput.SwitchCurrentActionMap("Game");
}
if (playerInput.actions["Accelerate"].ReadValue<float>() > 0f) // This action is on the "Game" action map
{
// I want this code to run immediately after calling SwitchCurrentActionMap, but it is false until the player releases and re-presses the button
print("Accelerate");
}
}
}