Search Unity

Cannot add Keyboard Space to currentActionMap

Discussion in 'Input System' started by dCalle, Feb 21, 2021.

  1. dCalle

    dCalle

    Joined:
    Dec 16, 2013
    Posts:
    55
    Alright, I have multiple Actionmaps and after switching from one to another I have this code.

    Code (CSharp):
    1.         #if UNITY_EDITOR
    2.             if (PlayerInput.currentActionMap.FindAction("DebugPause") == null)
    3.             {
    4.                 PlayerInput.currentActionMap.Disable();
    5.                 PlayerInput.currentActionMap.AddAction("DebugPause", InputActionType.Button,
    6.                         "<Keyboard>/spaceKey").performed += context => Debug.Break();
    7.                 PlayerInput.currentActionMap.Enable();
    8.             }
    9.         #endif
    and you guessed it, the Editor doesn't pause, so what am I doing wrong? My guess is, that the "<Keyboard>/spaceKey" isn't the binding it actually needs, but I haven't found anything about this in the Documentation

    (the debug.break is just a simplification, the method behind it still doesn't get called)
     
    Last edited: Feb 21, 2021