unityscript - Loop for stacking time (C#, Unity) -


i'd count time 10 seconds, make counttoten = 0 , start loop again until reaches 10 again. now, unity crushing , don't know why.

can me?

public float counttoten;     void update(){        do{             if(counttoten<=10){                counttoten=(int)(time.time%60f);             }         }         while(counttoten<=10);} 

that loop block update time won't change until update funciton finishes executing. instead, guess want count 10 seconds something, wait 10 seconds.

the unity way of doing co-routine. basically, like:

ienumerator waitthendosomething(float waittime) {     while(running)      {         yield return new waitforseconds(waittime);         dosomething();     } } 

where dosomething() function executed every 10 seconds until running set false. can start running following code in start() method:

startcoroutine(waitthendosomething(10.0)); 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -