Custom KeyCode Variable
<p>I'm creating a virtual launchpad, and I am going to have this one script attached to each button, but I need it to be modular so that I don't need 64 different scripts that do the exact same thing. </p>

<p>My issue is I'm not sure how I can get KeyCodes a public variables. So if I declared a public variable named "theKey":</p>

<pre><code>if (Input.GetKeyDown(KeyCode.theKey))
{ //play sound etc. 
}
</code></pre>

<p>Something similar to that so that in unity I can use the inspector to insert what the hotkey will be for the button this script is attached to.</p>

<p>KeyCode.String doesn't work, and I need full KeyCodes like .Alpha2</p>

<pre><code>public class LaunchManager : MonoBehaviour {

// Define public variables
public Button b11;

// Initialization
void Start () {
}

// Update is called once per frame
void Update () {

    var pointer = new PointerEventData(EventSystem.current);

    // For Single Use (sound emmission) 
    if (Input.GetKeyDown(KeyCode.Alpha2)) {
        // Click Button from keypress
        ExecuteEvents.Execute(b11.gameObject, pointer, ExecuteEvents.pointerDownHandler);
        // Play Sound
        GetComponent&lt;AudioSource&gt;().Play();
    }

    // Execute while clicking
    if (Input.GetKey(KeyCode.Alpha2)) {
        //set button colour to pressed state
    }

  }
}
</code></pre>

<p>Any help much appreciated. I did check around thoroughly for an answer to this. If I'm still missing relevant details let me know and I will respond.</p>