- Home /
Question by
ryekis · Oct 20, 2016 at 07:56 PM ·
audioaudiosourceaudioclipaudio.playoneshot
Audio does not finish playing whenever I press another key
Hi, I have a 5-second audio that I want to play if I click my left mouse button. However, whenever I try to press another key in my keyboard, the sounds stop playing. It does not finish playing the audio.
Thanks in advance :)
Here's my code:
public AudioClip mySound1;
AudioSource audio;
// Use this for initialization
void Start () {
audio = GetComponent<AudioSource>();
}
// Update is called once per frame
void Update () {
if (Input.GetButtonDown("Fire1")) {
audio.PlayOneShot (mySound1);
}
}
Comment
yes..footstep sound integrated in the FPS controller...