Given the follow code snippet:
public string[] key;
void Update()
{
for( int index = 0; index < key.Lenght; index++ )
if( Input.GetKeyUp( key[index] ) )
DoSomething();
return;
}
At any key up time I ever get the exact index, i.e, any key into the range of array causes DoSomenthing() runs. But there is a interaction, why do array index matches to the exact key? Is it a correct use or is it a simply runtime mistake?