Search Unity

How to access "tilde" key?

Discussion in 'Scripting' started by ultraviol3nt, Feb 3, 2013.

  1. ultraviol3nt

    ultraviol3nt

    Joined:
    Jan 17, 2010
    Posts:
    155
    A lot of games use the "tilde" key to open and close a command console in-game, e.g. Battlefield, Counter Strike, etc. So I figured I'd make similar functionality as well. Only problem is...

    I don't know what the keycode is for it. Scripting reference returns no results, searching the Key Code reference page returns nothing, not really sure if there are other names for it. This one has completely eluded me.

    How do I access the tilde key with GetKeyDown?
     
  2. Elryk

    Elryk

    Joined:
    Jan 2, 2013
    Posts:
    82
  3. chrisall76

    chrisall76

    Joined:
    May 19, 2012
    Posts:
    667
    Code (csharp):
    1.  
    2. if(Input.GetKeyDown(KeyCode.Shift)  Input.GetKeyDown(KeyCode.BackQuote)){
    3.     //Code Here...
    4. }
    5.  
     
  4. ultraviol3nt

    ultraviol3nt

    Joined:
    Jan 17, 2010
    Posts:
    155
    Oh, backquote, alright :D
     
    gooby429 likes this.