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
8
Question by user-297 (google) · Jan 05, 2010 at 09:31 PM · timetimescale

Time.time explanation.

Can you explain how to use Time.time, how it work?

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 SisterKy · Jul 21, 2011 at 11:32 PM 0
Share

cross-reference http://answers.unity3d.com/questions/14288/can-someone-explain-how-using-timedeltatime-as-t-i.html Greetz, $$anonymous$$y.

1 Reply

· Add your reply
  • Sort: 
avatar image
21

Answer by duck · Jan 05, 2010 at 09:50 PM

Time.time simply gives you a numeric value which is equal to the number of seconds which have elapsed since the project started playing.

The value is a 'float', which means that you get exact time including the fraction of the second which is currently elapsing, rather than discrete whole-number seconds.

Time.time is useful for many purposes, and it's often used when comparing the current time against a time stored in a variable, to check how much time has elapsed since a certain moment, or how much time remains until a certain future moment.

A common mistake is to use Time.time as the 3rd parameter for a 'Lerp' function. When using Lerp, you would usually need to use Time.deltaTime instead.

Time.time never changes during the course of a function, so you cannot use it to profile code that takes place inside a single function. Time.time (and Time.deltaTime) only change their value once per frame.

For more information, see the Time.time manual page, and the Time Class manual page which - if you click on each function or property of the class - has examples of how to use each of these things.

Comment
Add comment · 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 TowerOfBricks · Jan 05, 2010 at 10:18 PM 0
Share

When you say Time.time and delta time does not change during a function call, does that include realTimeSinceStartup too? You have given this answer in some other threads too but you never say anything about Time.realTimeSinceStartup.

avatar image jashan · Jan 06, 2010 at 07:30 AM 0
Share

The main difference betweeen Time.time and Time.realTimeSinceStartup is that the latter is not effected by Time.timeScale. In other words: If you have Time.timeScale = 0.1F, when Time.realTimeSinceStartup = 10F, Time.time would be 1F (10 seconds in "real time" would be equivalent to 1 second of "game time").

avatar image runevision ♦♦ · Jan 06, 2010 at 04:33 PM 1
Share

Time.realTimeSinceStartup DOES change during a function call.

avatar image angrypenguin · Oct 17, 2013 at 12:35 AM 2
Share

"A common mistake is to use Time.time as the 3rd parameter for a 'Lerp' function. When using Lerp, you would usually need to use Time.deltaTime ins$$anonymous$$d."

Actually, that's another common mistake which will result in similar but incorrect behaviour, and which will never actually reach the target. Lerp needs a number between 0 and 1, where 0 places the lerped object at the start, 1 places it at the end, and values between put it at some proportion between the two.

See here.

avatar image Pulov · Mar 06, 2015 at 10:37 PM 3
Share

It is funny because unity uses time.time in the example of a lerp

http://docs.unity3d.com/ScriptReference/$$anonymous$$athf.Lerp.html

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

2 People are following this question.

avatar image avatar image

Related Questions

Timescale help 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

how to pause time when hit an object 0 Answers

Trying to delay movement of a GameObject 1 Answer

Physics behave weirdly after timeScale change 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