Quantcast
Channel: Questions in topic: "javascript"
Viewing all articles
Browse latest Browse all 68

How do I unpause my game using Time.timeScale?

$
0
0
I'm trying to write a pause script and I can't figure out how to unpause properly. Can anybody help? Here's what I have but it's not working: #pragma strict var gamePaused : boolean = false; function PauseGame() { if(gamePaused == false && Input.GetKeyDown(KeyCode.Escape) == true || Input.GetButtonDown("Start")) { Time.timeScale = 0; gamePaused = true; } } function UnPauseGame() { if (gamePaused == true && Input.GetKeyDown(KeyCode.Escape) == true || Input.GetButtonDown("Start")) { Time.timeScale = 1; gamePaused = false; } } function Update() { PauseGame(); UnPauseGame(); }

Viewing all articles
Browse latest Browse all 68

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>