Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to detect keyboard constantly?

Discussion in 'Scripting' started by Ray_d, Jul 9, 2014.

  1. Ray_d

    Ray_d

    Joined:
    Jul 9, 2014
    Posts:
    2
    I write a translate script in Update function, but the object can only move once with key down once, I wanna press a key and let the object move constantly, how to do it?
     
  2. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
    Try... Input.GetKey(Keycode.K)
     
  3. Ray_d

    Ray_d

    Joined:
    Jul 9, 2014
    Posts:
    2
    Thanks! I think I should go back to scripting reference and know more about scripting!