Hi, i have a problem with the sound effect on my buttons, when i press the button the sound play perfectly, but when i added Application.LoadLevel (); to my script, the sound cuts, i think it loads the other scene before the sound plays totally.
Is there a solution for that ?
Thanks a lot
public var sound1 : AudioClip;
function Update ()
{
if (Input.GetMouseButtonDown(0))
{
var hit : RaycastHit2D = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
if(hit.collider.name == "button")
{
audio.PlayOneShot(sound1);
}
}
if (Input.GetMouseButtonUp(0))
{
Application.LoadLevel ("Level 1");
}
}