'Unity mapping keys incorrectly
Just to illustrate with some code, Unity is not recognizing the correct alpha key codes the way it is supposed to. Sometimes it recognizes the keys appropriately, but not every time. This happens even when I run a few simple lines of code.
for(int index = 0; index < nextStates.Length; index++)
{
if (Input.GetKeyDown(KeyCode.Alpha2 + index))
{
state = nextStates[index];
}
}
The above code, for example, recognizes the 2nd key on my keyboard. But not every single time and it's pretty basic. What am I doing wrong?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
