Quantcast
Viewing latest article 7
Browse Latest Browse All 11

Answer by ysleungrockman

Although it is very old question, I think I found a way that actually works: void Update() { StartCoroutine(GenerateEvent()); } IEnumerator GenerateEvent() { enabled = false; int _wait = Random.Range(8, 12); yield return new WaitForSeconds(_wait); enabled = true; } `enabled` only enables/disables `Update()` and it does not affect the CoRoutine so by putting `enabled = false` and `enabled = true` in, it would not run every frame. (However, thing I do not know is if it would affect the performance too much, so it may not be the best answer.)

Viewing latest article 7
Browse Latest Browse All 11

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>