Pause GameLoop with Pause Button

Hi there,

I have a central Manager class, that starts _GameLoop function within its Start() function via InvokeRepeating("_GameLoop", 0, 1);

Now I have another class handling some user input. I have a pause button there. When clicked, I want the gameLoop to pause until the button is being clicked again.

But I have no real clue how. Can you tell me how?

I used InvokeRepeating, so I could count the system time properly, which is needed for calculations later on. But I wonder whether I should have implemented it differently. Maybe with some CoRoutine?

You can use CancelInvoke to stop it and you might control it with a bool inside a coroutine

For example

IEnumerator Routine()
if(Paused == false)