Hi everyone! I’d like to ask a more “theorical” question, mainly regarding performance.
If I want something to be executed periodically (but not as frequently as Update() would do it), what is my best option available, performance-wise?
Is it this:
InvokeRepeating("DoSomething", 0.0f, TIME_BETWEEN_EXECUTIONS);
void DoSomething() {
Debug.Log("Hello Internet!");
}
… Or this?
StartCoroutine(DoSomething());
IEnumerator DoSomething() {
while (true) {
Debug.Log("Hello Internet!");
yield return new WaitForSeconds(TIME_BETWEEN_EXECUTIONS);
}
}
Thoughts?
Thank you for your time!