Search Unity

Question How to find out if a key has been pressed via events

Discussion in 'Input System' started by bdovaz, Aug 15, 2022.

  1. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,051
    @Rene-Damm I know by pooling I can do:

    Code (CSharp):
    1. if (Keyboard.current.enterKey.wasReleasedThisFrame) { }
    .

    But I want to do it via events so I can do it from a script that doesn't inherit from MonoBehaviour.

    How can I do it?

    Thanks!