Maxwell
11/19/2019 - 6:37 PM

Coroutine

private IEnumerator coroutine;

void Start()
{
    coroutine = WaitAndPrint(2.0f);
    StartCoroutine(coroutine);
}

private IEnumerator WaitAndPrint(float waitTime)
{
  while (true) // Remove this to only run Coroutine once.
  {
      yield return new WaitForSeconds(waitTime);
      print("WaitAndPrint " + Time.time);
  }
}