Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by Xatoku · Mar 01, 2012 at 12:46 AM · objecttimefreezepauseone

Stop Time for Specific Objects?

Hey guys. I am well aware of how to "pause" the game by freezing time using Time.timeScale, but would it be able to only apply that effect to specific objects?

I want one object to continue it's script, animations, and movement while all of the othes stop in place, if that would be possible.

Comment
Add comment · Show 1
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 Hamesh81 · Jan 27, 2013 at 10:16 AM 0
Share

I would also like to know this. Any updates?

4 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by jspease · Mar 01, 2012 at 06:22 AM

This isn't very convenient, but one thing you could do is set Time.timeScale to a very small value and then multiply everything (for your unfrozen object only) that depends on time by the inverse of that value.

For example, set Time.timeScale to 0.0001, then multiply by 10000 everywhere your object's scripts use Time.deltaTime, and multiply your object's animation speed by 10000, and if your object has any particle effects on it then multiply many of their properties by 10000, and if it has a Rigidbody then do some horrible things to speed up the Rigidbody component until it feels like normal speed, and change it all back when you want time to go back to normal...

It sounds like a lot of error-prone work, and it can be (depending on how complex your object is), but I have personally used it successfully in the past. And the good part is that you only need to worry about making changes to the one object that you want to be unfrozen; all other objects in the game will be automatically taken care of by the low timeScale value and will properly resume when the timeScale is changed back to normal, as long as you are using Time.deltaTime correctly in their scripts instead of doing calculations that rely on a particular framerate.

Of course, with this method, the other objects aren't quite completely frozen, but you can set timeScale low enough that the player will not be able to tell the difference, or you could set timeScale high enough that the player can see a little slow-motion and call it a feature.

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 Ryan Howse · Feb 06, 2014 at 03:15 AM

I know this post is two years old, but I just wanted to add that you CAN technically stop time for specific objects, because Time.timeScale only affects things operating under FixedUpdate (as a whole). So if you have an object you want to be able to move around when something is paused you can simply put anything you want to be pauseable in FixedUpdate and your non-pauseable objects in Update. Its not the most elegant solution, but it works.

Comment
Add comment · Show 2 · 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 PiFLYON · Feb 05, 2017 at 02:05 AM 0
Share

Thank you Ryan for this powerful information ! I just changed all my Update() to FixedUpdate() (except for controller inputs) and now I can animate what I want in a Pause $$anonymous$$enu ;-)

avatar image slackz · Mar 10, 2018 at 07:01 PM 0
Share

Thanks for the info. Do you know if there's a way to apply this concept to animationEvents? $$anonymous$$y scenario is particularly I want a game pause menu animation to load while everything else is subject to paused or sufficiently slow time. Thanks! Searching around and will reply here if I find a good solution

avatar image
0

Answer by louptony · Feb 12, 2015 at 03:41 PM

If you want object to keep moving, you would not use time.timeScale. You would need to use

rigidbody.isKinematic = true

for each of your object that you need to stop and keep the one you want to move to false value. This way, your object would keep moving.

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 Berenger · Mar 01, 2012 at 02:38 AM

From what I understand, that's one of the stuff people hope to get in unity 4.0

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

11 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

Related Questions

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

How to stop Audio Track in Timeline? 1 Answer

Cycle Textures Over Time 2 Answers

Emmiter in time intervals 1 Answer

How to destroy in an amount of time 1 Answer


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