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);
}