Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. bool isPaused;
  2.  
  3. void Start ()
  4. {
  5. isPaused = false;
  6. }
  7.  
  8. void OnGUI ()
  9. {
  10. if (!isPaused)
  11. {
  12. if (GUI.Button(new Rect(10,10,50,50), "Pause"))
  13. {
  14. Time.timeScale = 0f;
  15. isPaused = true;
  16. }
  17. }
  18. if (isPaused)
  19. {
  20. if (GUI.Button(new Rect(10,10,50,50), "Play"))
  21. {
  22. Time.timeScale = 1.0f;
  23. isPaused = false;
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement