Stopping FixedUpdate

In my lockstep multiplayer game, I run specific simulations in FixedUpdate that need to be stopped under certain circumstances (I.e. in case of high latency). Normally, I’d use Time.timeScale = 0 but this is not possible because my coroutines would be affected, something that I need to run continuously. Can I stop FixedUpdate without using Time.timeScale? Would there be any glitches if I set Time.fixedDeltaTime to Mathf.infinity?

The solution is using a boolean to control FixeDUpdate, something very controllable by me. Then I can use a coroutine or invoke repeating to keep the package sends.

You can use a variable to check if a certain is met and execute the code. If the condition is not met - this is the case when you don’t want to execute the code - set the variable to false. For example:

// ...
public static bool shouldExecute;
// ...
void FixedUpdate() {
if (shouldExecute == true) {
     // your code within FixedUpdate
}
}

This way you can access shouldExecute variable from anywhere like this: ClassName.shouldExecute and set the value to true or false. I hope this helps.