Is there anything like this for KeyCode?
using UnityEngine;
void LateUpdate ()
{
KeyCode[] keyCheck = new KeyCode[4];
if (Input.anyKeyDown == keyCheck[2])
Debug.Log(Input.inputString);
}
Is there anything like this for KeyCode?
using UnityEngine;
void LateUpdate ()
{
KeyCode[] keyCheck = new KeyCode[4];
if (Input.anyKeyDown == keyCheck[2])
Debug.Log(Input.inputString);
}
You may be looking for something like this. Please be sure to change the declaration (the first line) to the Start function!
void Update()
{
KeyCode[] keycodes = new KeyCode[]{ KeyCode.W, KeyCode.A, KeyCode.S, KeyCode.D };
for (int i = 0; i < keycodes.Length; i++) if (Input.GetKeyDown(keycodes_)) Debug.Log("Pressed " + keycodes*);*_
}
Right now you are creating an array of KeyCode types. Which has been initialised but not populated.
If I understand what you are trying to do i think you’d need to do this
KeyCode[] keyCodes = new KeyCode[]
{
KeyCode.A,
KeyCode.B
};
if (Input.GetKeyDown(keyCodes[2]))
{
Debug.Log(Input.inputString);
}