Input System | I can't disable action maps on Awake/Start

Hey there! this is my first topic on the new Unity Discussions. I’m having a weird but interesting issue with the Input System 1.11.12 and Unity 6.0

The thing is, that I have two input actions that are mutually exclusive on different action maps (binded to the same keys). There’s Previous/Next on the Player that are binded to Q/E keys and CCTV_Previous/CCTV_Next that are also binded to the Q/E keys.

My idea was changing between action maps when I interact and exit the CCTV mechanic and it worked as expected, but when I was doing general regression on the game mechanics, I noticed that all action maps were active at the start. I created a script to disable them and then enable the Player, but no matter how many different ways I tried to disable all action maps at both the Awake and Start method, it doesn’t care. The Input Debugger keeps telling me that the action maps are enabled, even though the PlayerInput says that they’re disabled.

Have you ever seen this? Could this be an Input System bug? or is the PlayerInput component kicking me in the nuts.

My latest attempt was the following:

    private void Awake()
    {
        // Player Input is disabled by default
        _playerInput = GetComponent<PlayerInput>();

        // Disable all action maps
        foreach (var actionMap in _playerInput.actions.actionMaps)
        {
            actionMap.Disable();
            Debug.Log($"Action Map '{actionMap.name}' Disabled: {actionMap.enabled}");
        }
        
        // Enable PlayerInput component
        _playerInput.enabled = true;
        _playerInput.SwitchCurrentActionMap("Player");
    }

Thanks a lot for your help and opinions!

1 Like

I’m seeing the same thing (though with just InputActionMap). Viewing the callstack while debugging in InputActionMap.Enable(), I see it called a lot… but problematically after my Start(), once by the InputSystem itself, in reaction to OnPlayModeStateChanged(), and again by UIElements calling InputForUI’s Initialize() – even after a frame.

So in the end I’m doing a StartCoroutine, with TWO yield return null; lines before turning the map off.

		void Start()
		{
			targetActions = InputSystem.actions.FindActionMap("Target");
			// get some actions and bind callbacks...

#if UNITY_EDITOR
			StartCoroutine(LateStart());
		}
		IEnumerator LateStart()
		{
			// Because it seems UI Toolkit might re-enable action maps, somehow even after a frame

			yield return null;
			yield return null;

			targetActions.Disable();
#endif
		}

This might only be needed for editor code? Otherwise remove that #if UNITY_EDITOR part