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

'GetKey' Not Working

Discussion in 'Scripting' started by Ultimate_Cooper, Jul 27, 2020.

  1. Ultimate_Cooper

    Ultimate_Cooper

    Joined:
    Jul 27, 2020
    Posts:
    8
    If ( Input.GetKeyDown(KeyCode.d) )
    {

    }

    Why isn't this working? I just get heaps of errors in the console. I'm following a tutorial on Youtube and I have quite a lot of coding experience, just not in C#. Help please!
     
  2. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    Should be
    KeyCode.D
    , not
    KeyCode.d
    .
    Case-sensitive.
     
  3. mopthrow

    mopthrow

    Joined:
    May 8, 2020
    Posts:
    343
    d should be uppercase :)
     
  4. Ultimate_Cooper

    Ultimate_Cooper

    Joined:
    Jul 27, 2020
    Posts:
    8