Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ganesh-mune · Jan 29, 2013 at 09:51 AM · pausedelay

How to PAUSE A game for perticular time

I want to give delay to my game in the starting and don't want to move or work any object except the main game players Animation.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DeveshPandey · Jan 29, 2013 at 11:07 AM 0
Share

Have you tried Time.timeScale = 0; ?

avatar image Mikilo · Jan 29, 2013 at 11:34 AM 0
Share

He specified "except the main game players Animation". I'm not sure that your solution can handle this case.

avatar image DeveshPandey · Jan 29, 2013 at 12:21 PM 0
Share

Oh YES, I forgot that animation will stopped when timeScale = 0, sorry. I suggest the answer by "Nguyen $$anonymous$$ichaël".

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Mikilo · Jan 29, 2013 at 10:00 AM

Hi,

I never try something like that. But you could try to write a script that will disable the GameObject in Awake(). In Update(), you wait until your delay passed, and then enable and destroy your component.

Or maybe, write a script that will disable all GameObjects in the scene except the one you want and wait for the delay to enable.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Halogenic8 · Jan 29, 2013 at 01:00 PM

A solution I've used before that is quite flexible if your game has a lot of pausing and resuming in it is to broadcast a message called "OnPause" or something similarly named.

Any gameobjects that you want to receive it should implement the method OnPause (to receive the message) and do some conditional logic probably involving a 'paused' boolean. So you can do something like this in Update():

 bool paused = true;
 
 void Update()
 {
     // only do some stuff if paused is false
     if (!paused)
     {
         doSomeStuff();
     }
 }
 
 void OnPause()
 {
     paused = true;
 }

You can also implement a resume message to unpause any currently paused gameobjects by setting the 'paused' boolean back to false;

 void OnResume()
 {
     paused = false;
 }

With the code above all of your gameobjects will start paused until you broadcast the "OnResume" message.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Milo_del_mal · Feb 08, 2013 at 09:40 PM

In addition to the previous comment... You want to Disable your rigid bodies when you are on pause, and re enable them on resume.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Moving Platform with delay not working 0 Answers

Make enemy wait before attacking player 2 Answers

Pause menu... Isn't pausing everything... 1 Answer

How to save players position then load a level (pause menu) 2 Answers

pause the audiolistener of the main camera doesn't stop it from generating sound 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges