Skip to content

Instantly share code, notes, and snippets.

@robertwahler
Created October 20, 2015 13:11

Revisions

  1. robertwahler created this gist Oct 20, 2015.
    8 changes: 8 additions & 0 deletions WaitForExample.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    // Avoid GC when coroutines wait, instantiate outside of loop
    WaitForSeconds shortWait = new WaitForSeconds(1.0f);
    private IEnumerator Run() {
    while (true) {
    // do stuff here
    yield return shortWait;
    }
    }