wayne57
1
I have this script for playing A sound when the a button is pressed but would also like to have the D button play the sound too. Its for a turret when it turns.
Can someone help me out with this. Here is the script i use
function Update () {
if (Input.GetKey(KeyCode.A)) {
audio.Play();
} else {
audio.Stop();
}
}
Just use the logical OR (||) operator:
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D)) {
audio.Play();
} else {
audio.Stop();
}