unity have code trigger every so often code example
Example: unity do task every x seconds
private float nextActionTime = 0.0f;
public float period = 0.1f;
void Update () {
if (Time.time > nextActionTime ) {
nextActionTime += period;
// execute block of code here
}
}