Why does my game crash when the Time.timeScale is set to 0?

I made a simple pause menu that works like this: When I press the pause button, Time.timeScale is set to 0, some UI elements appear on the screen and I can switch options by pressing up or down. Nothing fancy and works just fine in the editor.

The problem happens only when I build the game. If I try to switch options when the game is paused, the game crashes. Every other menu works fine because the timeScale is still set to 1.

If I set the timeScale to something like 0.0000001f it works but causes some other unrelated issue.

Does anyone know why is this happening? I’m using version 2019.3.0f6.

Time.timeScale sets Time.deltaTime will return to zero, it doesn’t pause the game.

To pause the game you can just stop the player from moving and block any input (except any required for a menu) Every game is different.