Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Pausing the Game through Coding in Unity3D

    • 0
    • 3
    • 3
    • 1
    • 0
    • 0
    • 0
    • 0
    • 650
    Comment on it

    You can pause your game in Unity3D by changing the rate at which the time is passing. It is very helpful in making pause menu in the game and in various situations that require pausing of all the events and physics to stop at the moment.

    To pause your game you can use Time.timeScale property. This property should be set to 0 to pause everything in the game and 1 to UnPause.

    Time.timeScale = 0; // To Pause
    Time.timeScale = 1; // To UnPause
    

    This has many interesting effect, for example if you use 0.5 instead of 1 you can slow down time.

    Hope it helps.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: