Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 BigScary · Nov 24, 2017 at 04:04 AM · update functionupdates

How to set updates per second for testing purposes?

I have a difficult testing problem. I've determined that on someone else's computer, the PC version of my game executes update() on game objects much more frequently than on my machine. This broke my game badly, and I was only able to fix it by GUESSING at fixes and then asking my friend to confirm whether the fixes worked. I want to look for other issues like this, using my own machine. Can I somehow tell the Unity editor to change the number of game frames per second when it runs, for my testing purposes?

Comment
Add comment
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

1 Reply

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

Answer by Bunny83 · Nov 24, 2017 at 04:46 AM

No, not really. There is the targetFrameRate setting but you can't really rely on it. If the hardware can't reach the desired framerate it would run slower. Also, as you can read on that page, depending on the target platform the setting might not have any effect at all.


The general solution to this problem is to make all your calculations framerate independet and make it time dependent. This is done by using Time.deltaTime as a factor in your calculations. For example when you want to move 5 world units per second you just add "5" multiplied by Time.deltaTime. This results in a fractional movement amount that will cause the object to move 5 units after one second.


Time.deltaTime is the time between the last frame and the current. 1f / Time.deltaTime will return the actual framerate. So at a framerate of about 60 fps deltaTime will be 1f / 60 == 0.01666. At 100 frames per second it will be 1f/100 == 0.01 and at 25 fps it will be 1f/25 == 0.04


It should be obvious if you have a frame rate of 25 frames per second and you add "0.04" every frame that it will be add up to "1" after 25 frames or one second.

Comment
Add comment · Show 1 · 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 BigScary · Dec 08, 2017 at 09:03 PM 0
Share

Thanks for the info on targetFrameRate. It's disappointing that it can't be relied upon - it's critical to be able to simulate performance differences across devices, especially considering how many platforms Unity can deploy to. I think it's unrealistic for an indie developer to own several different devices with differing performance profiles per target platform.

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

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

Related Questions

Third party patching software for mobile? 0 Answers

How often is the Unity software/code style updated? 1 Answer

unity 2020 preserve full collada names 0 Answers

Smooth Movement Along Waypoints & Update() vs FixedUpdate() 2 Answers

Moving Button Down Check from Update to separate Function 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