- Home /
Buzzing noise instead of my audio-clip?
I have been trying all night to get this to make my footstep-sound play whenever w, a, s or d is pressed down, but instead, i get a buzzing sound. I am pretty sure I have done everything right, but obviously that's not possible. Here is my script:
var footsteps : AudioClip;
var allowMove : boolean = true;
function Update() {
allowMove = Movement.allowMove;
if (Input.GetKey (KeyCode.W) && allowMove ||
Input.GetKey (KeyCode.A) && allowMove ||
Input.GetKey (KeyCode.S) && allowMove ||
Input.GetKey (KeyCode.D) && allowMove) {
audio.clip = footsteps;
audio.Play();
} else {
if (!Input.GetKey (KeyCode.W) &&
!Input.GetKey (KeyCode.A) &&
!Input.GetKey (KeyCode.S) &&
!Input.GetKey (KeyCode.D)) {
audio.clip = footsteps;
audio.Pause();
}
}
}
The variable allowMove is equal to a static variable from another script by the way.
Comment
$$anonymous$$ake sure your Audioclip is a supported format for your platform.
Your answer
Follow this Question
Related Questions
Help with sound clips [C#] 0 Answers
Get audio from device... -1 Answers
Play Sound when GUI button is pressed. 7 Answers
Audioclip timesample to seek start position but not the end 1 Answer
Random, 3d sound. 1 Answer