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 FinalMirage · Dec 01, 2012 at 08:57 PM · androidiphone

Is Time.deltaTime consistent across different platforms/devices?

The game I'm working on keeps track of the time it takes to complete a level, which is sent to the Leaderboards. The plan is to just have a global Leaderboard across all platforms since that'll result in more scores/competition/whatever.

Currently, I'm keeping track of game time using the following code:

 void Update()
 {
     CompletionTime += Time.deltaTime;
 }


A few questions have popped up that I'm not entirely sure about:

  1. Will this be handled exactly the same across all platforms? FPS doesn't change on a per-platform basis does it?

  2. What happens if the game starts running slow (slower device, framerate glitch, etc.)? A longer frame will result in a greater deltaTime so that should also remain consistent whether the game runs buttery smooth or really slow.

  3. Is Time.deltaTime appropriate for this? Should I just grab the 'Time.time' when the game completes instead?

Comment
Add comment · 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 Fattie · Dec 01, 2012 at 09:00 PM 0
Share

IN answer to your question 1,

lol, Time.deltaTime is not only different on every platform, it is different every frame. it is completely different all the time everywhere and always.

To achieve what you are trying to do, very simply use (3) or a variant thereof

note that Update should have utterly nothing to do with what you're trying to do. you'd simply do something, like, make a note of the time of day when the user starts a level, and make a note when she crosses the finish line (or, whatever). it's just that simple.

(Very generally, never use Update() at all, unless it's some arcane system related task.)

avatar image Eric5h5 · Dec 01, 2012 at 09:52 PM 0
Share

FPS doesn't change on a per-platform basis does it?

Of course it does. Every platform has different hardware capabilities.

it is completely different all the time everywhere and always.

Well, not if you use vsync and can maintain that framerate....

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by GerryM · Dec 01, 2012 at 09:08 PM

1) no, FPS does differ hugely among devices, even on the same device it will differ.

2) if your games runs slower deltaTime will increase, but as there are equally less calls to the update function the time measurement will be the same. That's basically the idea of deltaTime, to adjust for different framerates.

3) Time.time would be much more adequate, no need to waste resources on deltaTime in the update function, as you don't really need it. Check this answer.

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

12 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

Related Questions

how to convert Input.mousePosition into iphone/android accelerometer? 1 Answer

GUI Styles for iPhone/Android - font/button sizing? 3 Answers

Zero-ing the Input.acceleration.z 0 Answers

Best way to create/design modular Player 2 Answers

Addictive Games (not the website) 3 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