This can also be achieved with FixedUpdate(), right? Is there a rule for when to use FixedUpdate() and when to use Coroutines?
public float timer = 0;
public bool lightFlickering = false;
void Update() {
if (lightFlickeringOn) {
lightBulb.intensity = Random.Range(1.5f, 1.9f);
lightBulb.range = Random.Range(8, 15);
}
}
void FixedUpdate() {
timer += Time.deltaTime;
if (timer > 1.0f) {
timer = 0;
lightFlickeringOn = !lightFlickeringOn;
}
}