Search Unity

Function to return which keys are pressed and key remapping

Discussion in 'Editor & General Support' started by hsparra, Aug 16, 2005.

  1. hsparra

    hsparra

    Joined:
    Jul 12, 2005
    Posts:
    750
    First, is there a function that will return which keys are pressed? It looks like the Input.GetKey() you have to ask if a specific key is pressed.

    Second, what would be the preferred way to allow a user to remap the keys, for instance, if they wanted different up and down keys?
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    The screen selector contains a key configuration dialog.

    So instead of using Input.GetKey use Input.GetButton with virtual axes.
    Then your users can simple modify keyboard input to whatever they like and you don't have to put any effort into it at all.
     
  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Also there is a Input.inputString function which gives you what the users has typed during the last frame.
     
  4. hsparra

    hsparra

    Joined:
    Jul 12, 2005
    Posts:
    750
    Thank you for the reply. I will have to give those 2 functions a closer look.