1
\$\begingroup\$

I'm developing a game in Android and iOS platforms. I've an initial screen and I'm trying to get next menu scene after a delay of 4 seconds. It works ok in Android but in iPhone, the initial scene disappear in 1 second or less.

Can anyone help me?

This is my code (in C#) right now:

public class CargaPantallaInicio : MonoBehaviour {

    IEnumerator Start () {
        yield return new WaitForSeconds(4f);
        Application.LoadLevel("Menu");
    }
}
\$\endgroup\$
  • \$\begingroup\$ Does the Start() call without an IEnumerator return type work fine on iPhone? If so, you could write something like this: pastebin.com/jX5F71z8 \$\endgroup\$ – Ethan Bierlein May 11 '16 at 14:43
  • \$\begingroup\$ I try it but this error appears: error CS1624: The body of CargaPantallaInicio.Start()' cannot be an iterator block because void' is not an iterator interface type \$\endgroup\$ – Angelsm May 11 '16 at 16:38
  • \$\begingroup\$ I see you were here at the site, @Angelsm. Accept the answer that helped you. This is how StackOverflow works. Click the checkmark by the answer that solved your problem. \$\endgroup\$ – Almo May 14 '16 at 14:30
1
\$\begingroup\$

Currently Unity on iOS starts while the splash screen is still visible. Your scripts are already started in the background.

You will just have to make your delay longer on iOS builds.

IEnumerator Start () {
#if UNITY_IOS
    yield return new WaitForSeconds(10f);
#else
    yield return new WaitForSeconds(4f);
#endif
    Application.LoadLevel("Menu");
}

It's not ideal as the timing may change in the future but it should work as long as Unity doesn't change the splash screen behaviour in an update and/or you don't update Unity.

\$\endgroup\$
  • \$\begingroup\$ If it works, you are supposed to "accept" the answer by clicking the checkmark. You can even upvote the answer, to give Stephane another 10 points for his trouble. \$\endgroup\$ – Almo May 12 '16 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.