Coroutines or InvokeRepeating

Which one of these would you recommend if you would have something happen every second:

  1. Start a coroutine in Start() and use while(true){ yield return new WaitForSeconds(1f); } in the coroutine

  2. Start a coroutine in Update() and not use while(true)

  3. Use InvokeRepeating

Is anyone more performant than the others, or better practise? Is while(true) a bad way to make something happen over and over again?

Thank you!

InvokeRepeating will tend to be faster but you have slightly less control over it - you can’t yield with the called function and can’t cancel individual invoke calls. Go with InvokeRepeating at first. If you end up needing coroutine functionality later it is not hard to change to it.