- Home /
Button reaction time problem
I'm developing on Android and I have the Pro version. When I touch the Play button in my first scene there is a 2 second delay before the second scene loads. Does anyone know why I'm getting this delay? I have a feeling my script might not be set up right. Is there a more effecient way to create a button with a GUI Texture? I've noticed on other games that the button reaction time is much faster than any of my buttons. An suggestions? thanx
here's my button script:
function Update(){
if(Input.touchCount > 0){
var touch: Touch = Input.touches[0];
if(touch.phase == TouchPhase.Began && guiTexture.HitTest(touch.position)){
Application.LoadLevel("sk6");
var underGUI : GUITexture;
underGUI = GetComponent(GUITexture);
underGUI.enabled = false;
}
}
}
Also, the first collision(crash and die) in my scene is also very slow to respond. After the second and third time a player dies(collision) it works perfectly. Any suggestions why thats happening?
perhaps its a build setting like the webplayer has streamed? if you enabled streamed in webplayer, the first level loads into memory and then the rest comes late. What you explain sounds to me like caching/memory that is ready 2. and 3. time.
Answer by syclamoth · Sep 15, 2011 at 01:52 AM
Well, Application.LoadLevel is hardly a quick operation! If you use LoadLevelAsync instead, then you won't get the 2-second lag- it'll just wait until the level is loaded and then smootly shunt you into it. The 2-second delay is the time it takes to load the level, but if you're on Unity Pro, there's no reason why you can't use the Asynchronous version instead.
Your answer
Follow this Question
Related Questions
Android GUITexture Touch 0 Answers
Holding GUI Button Touch to Rotate Object 0 Answers
Why this simple code doesnt work? 0 Answers
Switching a GUIbuttons texture when holding your finger on it? 1 Answer
Android touch gui help!!! 2 Answers