Search Unity

Check if no player input for period of time

Discussion in 'Input System' started by nathanjams, May 28, 2021.

  1. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    Hello,

    I would like to enable a cutscene if there is no input from the player after a period of time. With the old system you could run a check with
    Code (CSharp):
    1. Input.anyKey
    Is there something comparable with this new system?

    Thanks,
    Nathan
     
  2. If it is okay to check only the valid input (so if you don't use for example the 'O' key for anything, 'O' key won't count for you as user input), then you can use the InputActionMap.actionTriggered.
    https://docs.unity3d.com/Packages/c...ne_InputSystem_InputActionMap_actionTriggered

    This happens every time when an action in this ActionMap changes phase. Which means the last cancelled will be called last. You can reset your timer (counting towards the cutscene) here.
     
    nathanjams likes this.
  3. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    Thanks again!