Game Extensions
Pause
This method pauses the game by setting Time.timeScale to 0, effectively freezing all time-dependent operations.
GameExtensions.Pause();
Resume
This resumes the game by restoring Time.timeScale to 1, allowing normal gameplay to continue.
GameExtensions.Resume();
Restart
This method restarts the game by geting the current scene using SceneManager. It also resets Time.timeScale to 1.
GameExtensions.Restart();
Speed Up
This speeds up the game by increasing the time scale to 2f, making everything in the game run twice as fast.
GameExtensions.SpeedUp(2f);
Slow Down
This method slows down the game by reducing the time scale to 0.5f, making everything move in slow motion.
GameExtensions.SlowDown(0.5f);
Reset Time
This resets the time scale to its default value of 1, ensuring that the game runs at normal speed.
GameExtensions.ResetTime();
Last updated