How can I change my script to un-pause my project?

Currently, I added a simple script consisting of a time.timeScale = 0.0 to pause my game when a keypress is initiated. I was wondering how to return the time.timeScale back to 1.0 using the same button.

This is what I came up with, and tried multiple things to un-pause it. I don’t have an actual menu for pausing, it just stops all movement EXCEPT camera rotation (which I want to keep):

`function Update () {

if (Input.GetKeyDown ("escape")) {
	Time.timeScale = 0.0;



Set a bool ‘isPaused’ to false. In C# it’d be like:

if (!isPaused) {
Time.timeScale = 0.0f;
isPaused = true;
else {
Time.timeScale = 1.0f;
isPaused = false;