Skip to main content
added 1 character in body
Source Link
wondra
  • 4.9k
  • 1
  • 23
  • 36

Alternatively, there is one-liner withusing modulus:

void Update() { //if you want it loop from specific start time rather than from start of the game, //subtract said time value from Time.time argument value if(Mathf.Repeat(Time.time, execDuration + sleepDuration) < execDuration) executeFunction(); } 

Alternatively, there is one-liner with modulus:

void Update() { //if you want it loop from specific start time rather than from start of the game, //subtract said time value from Time.time argument value if(Mathf.Repeat(Time.time, execDuration + sleepDuration) < execDuration) executeFunction(); } 

Alternatively, there is one-liner using modulus:

void Update() { //if you want it loop from specific start time rather than from start of the game, //subtract said time value from Time.time argument value if(Mathf.Repeat(Time.time, execDuration + sleepDuration) < execDuration) executeFunction(); } 
Source Link
wondra
  • 4.9k
  • 1
  • 23
  • 36

Alternatively, there is one-liner with modulus:

void Update() { //if you want it loop from specific start time rather than from start of the game, //subtract said time value from Time.time argument value if(Mathf.Repeat(Time.time, execDuration + sleepDuration) < execDuration) executeFunction(); }