For example, when I hit “A” I need everything stop like time freezing but except a camera.
Another example like when you play some RTS game that can pause a time anyways you can still move a camera around.
In this case you don’t muck about with Time.timeScale. Instead you just make your own global variable that indicates when the game is paused, and all your scripts that you want to pause, check this variable and bail out, e.g.:
void Update() {
if (PauseManager.isPaused) return;
// ...do stuff...
}
Of course this assumes you’re not using the physics engine, which I generally recommend anyway. ![]()
2 Likes
You can also use Time.unscaledDeltaTime for things that don’t pause.
2 Likes