i submitted a bug about this a while ago, but havnt heard anything so i thought id ask here.
i want to play a sound when i touch an object.
it does play but there is a significant delay before the audio plays.
I know the touch is immediate because the instantiate happens without delay.
there are no errors or warnings in unity or in xcode. any insight is appreciated.
var Pitch = 1.0;
var particle : GameObject;
function Update ()
{
for (var touch : Touch in Input.touches) {
if (touch.phase == TouchPhase.Began) {
// Construct a ray from the current touch coordinates
var ray = Camera.main.ScreenPointToRay (touch.position);
if (Physics.Raycast (ray))
var hit : RaycastHit;
if (Physics.Raycast (ray, hit) hit.transform == this.transform)
{
audio.Play ();
audio.pitch = Pitch;
Instantiate (particle, transform.position, transform.rotation);
}
}
}
}