I am getting about a .1 second delay from when I start a sound to the time it actually starts playing.
void Update () {
if (Input.GetKeyDown("j"))
{
if (atBeginning)
{
startTime = Time.time;
atBeginning = false;
atEnd = false;
door.audio.Play();
}
else
{
atBeginning = true;
atEnd = false;
transform.position = start.transform.position;
}
//AudioSource.PlayClipAtPoint(clip, transform.position);
}
if (!atBeginning !atEnd)
{
float p = (Time.time - startTime) / 2.0f;
if (p<0) p = 0; if (p > 1) p = 1;
if (p == 1)
{
atEnd = true;
//AudioSource.PlayClipAtPoint(clip3, transform.position);
}
transform.position = Vector3.Lerp(start.transform.position, end.transform.position, p);
}
if (Input.GetKeyDown("space"))
{
AudioSource.PlayClipAtPoint(clip2, transform.position);
}
}
This is happening if I use ogg or uncompressed wav files. I also have Decompress on Load checked. Anyway, I was just wondering if anyone has had similar problems or knows of a way to reduce the delay.