Search Unity

How to make a script refresh every 5 minutes?

Discussion in 'Scripting' started by Bikebreck, Dec 6, 2010.

  1. Bikebreck

    Bikebreck

    Joined:
    Aug 4, 2010
    Posts:
    112
    How would you make a script refresh every 5 minutes? It is for a live web cam.

    BIkebreck
     
    Last edited: Dec 6, 2010
  2. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    992
    Code (csharp):
    1. function DoSomething(){
    2.    while(true){
    3.       // Do Something
    4.       yield WaitForSeconds(300);
    5.    }
    6. }
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    coroutine that yields for 5 minutes or invokerepeated with a 5 minute time offset
     
  4. Bikebreck

    Bikebreck

    Joined:
    Aug 4, 2010
    Posts:
    112
    were does the code go?
     
  5. svenskefan

    svenskefan

    Joined:
    Nov 26, 2008
    Posts:
    282
    Hey!
    don´t be so lazy ;)
    you got som nice ideas, now try to do something meaningful with them.