Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Key/Button Selectable in inspector

Discussion in 'Input System' started by owen_proto, Jun 16, 2020.

  1. owen_proto

    owen_proto

    Joined:
    Mar 18, 2018
    Posts:
    118
    I can't seem to find an equivalent for having a KeyCode selectable in the inspector and then using the key code variable to check for input. It seems like I might be able to do this with the Key enum, but I can't figure it out. I'm trying to do this with Keyboard/Gamepad.current etc. Is this possible?

    Edit:
    Welp, of course after so much searching and putting down, working around, and coming back to this, I figure it out for myself 20 minutes after asking for help on the forums haha! In case anyone else is looking for this:

    Code (CSharp):
    1. public Key myKey;
    2.  
    3. Keyboard.current[myKey].wasPressedThisFrame
     
    Last edited: Jun 16, 2020
    Lurking-Ninja likes this.