I am trying to add sound when the player is moving. I have a audio clip for running, and walking. How it works is if either w,a,s,or d, is held down play the clip during the duration of that time. Well when it plays it sounds like its looping(Maybe) extreamly fast. like ddddddddddddddd. Here is the script, yes i know this isn’t the best way to go about this but it will do for now. What might the problem be? How can I fix this?
public class PlayerSound : MonoBehaviour {
public AudioClip walkSound;
// Update is called once per frame
void Update ()
{
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S)
|| Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.W))
{
audio.PlayOneShot(walkSound, 0.7f);
}
}
}