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 /
This question was closed Oct 25, 2014 at 02:24 AM by Kiwasi for the following reason:

The question is answered, right answer was accepted

avatar image
2
Question by trs9556 · Apr 15, 2013 at 06:25 AM · timetime.deltatimescene-changedeltatimereturn

Time.deltatime is returning 0?

So in scene 1 I'm moving my camera using Slerp as shown below:

 theCamera.transform.rotation = Quaternion.Slerp(theCamera.transform.rotation, NextCameraPosition.rotation, Time.deltaTime * 2.25f);
 theCamera.transform.position = Vector3.Slerp(theCamera.transform.position, NextCameraPosition.position, Time.deltaTime * 1.75f);


So the logic is I press button 1 in scene 1 and it slerps. This works. If I go to a new scene then go back to scene 1 and press button 1 the slerp doesn't work. After about 2 hours of debugging I realized it is because Time.deltaTime is returning 0.

Has anyone experienced this? I didn't even know that could happen.

I added a debug button that just prints out Time.deltaTime. When I run my game and hit the debug button I get around 0.002. Once I go to a new scene then go back to my first scene the debug button prints out 0. So somehow some way time.deltaTime is returning 0.

Any information on the subject would be greatly appreciated. Thanks.

Comment
Comments Locked · Show 2
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 Bunny83 · Apr 15, 2013 at 07:55 AM 1
Share

please post your solution as answer and don't include it in your question. Post an answer and accept it to close the question.

avatar image DryTear · Apr 26, 2013 at 11:18 PM 0
Share

you could try:

 var myScale = 1;

 function Start()
 {
     Time.timeScale = myScale;
 }

1 Reply

  • Sort: 
avatar image
10
Best Answer

Answer by trs9556 · Apr 27, 2013 at 12:51 AM

So I figured it out for anyone else interested. The way I was returning to scene 1 was causing it. To go back to the "main menu, aka scene 1" I had to open up the pause menu.

The way I pause my game is by setting Time.timeScale to 0. So when I went back scene 1 timeScale was still set to 0 therefore deltaTime was returning 0.

I changed timeScale back to 1 and it works perfectly. Thanks for attempting to help for anyone who is reading this. (sorry it took so long bunny, and I didn't post it the first time because I figured it out before the post got approved, so I wasn't able to)

Comment
Comments Locked · Show 5 · 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 yuvraj.negi · Aug 01, 2014 at 05:32 AM 0
Share

Thanks, it helped me :)

avatar image Alvintchui · Aug 13, 2014 at 07:22 PM 0
Share

It saved me from the hell. thanks.

avatar image greenlotus · Oct 25, 2014 at 01:24 AM 1
Share

Nice one!! I just spent two hours investigating this Now I know exactly what is happening.

You my friend, are awesome!!

Cheers

avatar image Bunny83 · Oct 25, 2014 at 01:36 AM 0
Share

@greenlotus: Now you should have enough karma to upvote the answer ;)

avatar image wannibe · Dec 17, 2017 at 10:25 PM 0
Share

Life saver!!!!!

Follow this Question

Answers Answers and Comments

16 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 avatar image avatar image avatar image

Related Questions

2nd independent deltaTime and timeScale variables, or a way to mimic this? 1 Answer

CountDown Timer Help (Seconds problem) 2 Answers

Multiply deltaTime to arrive at point2 in 1.5 sec ? 1 Answer

Pause game that not using deltatime for movment 1 Answer

Time Manager Class Implementation Like Coroutine in Unity 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