Hi, I am trying to get a footstep sound put in my game but it’s just not quite working. The script below is what i currently have, and it does work, but if you lift up lets say… the W key while your still holding the S key, the audio will stop. How would i make that not happen?
function Update () {
if (Input.GetKeyDown("w") || Input.GetKeyDown("a") || Input.GetKeyDown("d") || Input.GetKeyDown("s")) {
audio.Play();
}
if (Input.GetKeyUp("w") || Input.GetKeyUp("a") || Input.GetKeyUp("d") || Input.GetKeyUp("s")) {
audio.Stop();
}
if (Input.GetKeyDown("left shift")) {
audio.pitch = 1.8;
}
if (Input.GetKeyUp("left shift")) {
audio.pitch = 1.55;
}
}