Coroutines in Unity
Mastering Coroutines in Unity in 10 mins: http://www.theappguruz.com/blog/how-to-use-coroutines-in-unity
Repeating timer via recursive coroutine
using UnityEngine;
using System.Collections;
public class Timer : MonoBehaviour
{
public float waitTime = 3f;
void Start()
{
StartCoroutine (HarmPlayer());
}
IEnumerator HarmPlayer()
{
yield return new WaitForSeconds(waitTime);
print (“Performing some action”);
StartCoroutine (HarmPlayer());
}
}
http://unitylore.com/articles/timers-in-unity/