- Home /
iOS : Delayed response to touch began?
Hi,
Starting from a new empty scene on Unity iOS, I'm simply adding an AudioSource and the following script to the main camera (purely for testing purposes). The script simply play a sound upon any touch. After launching on the iPad2, there is an approx 0.5 second delay between touching the screen and the audio playing! Is this the bottom-line performance, or should I be doing something else to improve the response of touches?
(Naturally, a similar script responds immediately when testing for a KeyDown on the Mac, so the delay is purely down to Touch it would seem.)
function Update () {
for (var i = 0; i < Input.touchCount; i++)
{
var touch : Touch = Input.GetTouch(i);
if (touch.phase == TouchPhase.Began)
{
audio.Play();
}
}
}
BTW, the problem persists even if I test for a single touch: if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
As far as I can tell, this is purely affecting the audio engine. Any simple graphics or physics changes are happening immediately upon GetTouch().
Answer by Zacker · Oct 18, 2011 at 04:00 PM
audio.Play() does take quite some ms on an iPad. Try using the profiler to see if it can tell you anything.
Your answer
Follow this Question
Related Questions
Touch Lag With S2 1 Answer
iOS - Audio Lag? 1 Answer
Is it normal for unity to lag slightly after adding detailed meshes? 1 Answer
Unity performance issues. 0 Answers