x


Chage level Whith time

Hello can some one help me, I am devloping a game in which you have to visit diferent places in a ''X'' amount of time I am using this code but I don't know why it dosen work...

    function Start(){

yield WaitForSeconds(30);

Application.LoadLevel(1);

yield return new WaitForSeconds(30);
        Application.LoadLevel(2);

}
more ▼

asked Aug 04 '11 at 03:01 AM

e_m_l_i_a_n_o gravatar image

e_m_l_i_a_n_o
-4 5 6 9

well, what DOES it do? Any errors? Greetz, Ky.

Aug 04 '11 at 06:23 AM SisterKy

In this code you wait 30 seconds, go to next scene and then wait another 30 seconds to go to next scene?

Aug 04 '11 at 07:08 AM Aldwoni
(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

You should call a coroutine in which you will yield the processing of this script for the rest of the processing of your code. try doing the following:

function Start()
{
    StartCoroutine("TimedLeveling");
}

function TimedLeveling()
{
    yield WaitForSeconds(30);
    Application.LoadLevel(1);

    yield WaitForSeconds(30);
    Application.LoadLevel(2);
}
more ▼

answered Aug 04 '11 at 07:12 AM

GuyTidhar gravatar image

GuyTidhar
2.2k 4 8 13

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x389
x329

asked: Aug 04 '11 at 03:01 AM

Seen: 682 times

Last Updated: Aug 04 '11 at 07:17 AM