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
4
Question by keyp3r · Dec 01, 2013 at 11:09 PM · fpsperformancetimestandalonetime.deltatime

Standalone builds run very fast on some computers?

For some reason on some computers my builds are running at around 1.5x - 2x times the speed. This is a huge problem and I have no idea where this problem may be rooted. I'm setting the target FPS (via Application.targetFrameRate) but that doesn't seem to do anything. Everything in the game is dependent on Time.deltaTime so I can't see a reason why this would change computer to computer. And it is consistent on the computers that it's fast and not fast on.

Any potential leads on where this issue could have stemmed from will be useful. Thanks a ton!

Comment
Add comment · Show 8
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 meat5000 ♦ · Dec 01, 2013 at 11:35 PM 0
Share

What is it exactly that is going quickly?

Have you tried printing the current Time.time to GUI to see it its normal?

If animation is the problem you may need to play with Fixed Time Step

avatar image Owen-Reynolds · Dec 01, 2013 at 11:41 PM 0
Share

Lerps? Like Lerp(A, B, 0.05)? Even if you toss in a time.deltaTime, the math is wrong (correct math involves solving a polynomial, I think.)

avatar image keyp3r · Dec 02, 2013 at 12:14 AM 0
Share

The entire game is going quickly. It's effectively as if I'd set the Time.timeScale to 1.5 or 2. This is a very difficult thing for me to test since it's only happening on a few computers, $$anonymous$$e not being one of them, so no, I haven't tried printing Time.time. And I have practically no animation in the game, everything is scripted movement. And yes, things like Lerps and $$anonymous$$oveTowards are also fast, since it appears as if time.TimeScale is getting warped... on ONE computer. haha

avatar image keyp3r · Dec 02, 2013 at 12:16 AM 0
Share

Also, being it's only occurring on a few computers, but most are fine, I can assume my math is fine and this is a Unity setting or performance variable I have to tinker with. Unless most think thats wholly untrue.

avatar image Spinnernicholas · Dec 02, 2013 at 02:20 AM 0
Share

How do you know it's running too fast if you don't have enough access to the computers to print debug information. Have you actually seen it running too fast first hand?

Show more comments

3 Replies

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

Answer by clunk47 · Dec 02, 2013 at 01:35 AM

Most modern NVIDIA and AMD GPUs have a control panel. Be sure VERTICAL SYNC is enabled in the GPU's control panel / settings. This usually syncs the game's framerate with your desktop's refresh rate. Also have a look at Unity's reference for settings of vSyncCount HERE.

I'm not really a graphics guru or anything, but I wonder if setting to every vBlank for 60Hz and setting to every other vBlank for 120Hz would work? Try something like this and let me know if it helps at all.

 using UnityEngine;
 using System.Collections;
 
 public class Example : MonoBehaviour
 {
     Resolution res;
     
     void Start()
     {
         res = Screen.currentResolution;
         if(res.refreshRate == 60)
             QualitySettings.vSyncCount = 1;
         if(res.refreshRate == 120)
             QualitySettings.vSyncCount = 2;
         print (QualitySettings.vSyncCount);
     }
 }

Comment
Add comment · Show 3 · 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 keyp3r · Dec 02, 2013 at 02:25 AM 2
Share

Looking into that a bit more it turns out that it's because the monitors being used are 120hz. Apparently moving the game to a second monitor (not 120hz) fixed it. Interesting. I'm not sure what to do with that info exactly... is this tied to the vSync still? If I remove vSync entirely (or add an option for it in the options) do you think that should fix it? Thanks btw, this is leading to a solution! = D

avatar image keyp3r · Dec 04, 2013 at 04:14 AM 1
Share

Looks like that worked! vSync level 2 runs fine on 120hz monitors! Thanks a ton man.

avatar image clunk47 · Dec 04, 2013 at 04:29 AM 0
Share

Sweet!!! First time I had to deal with this so had my fingers crossed lol. So glad I was able to help :D

avatar image
1

Answer by Spinnernicholas · Dec 02, 2013 at 01:51 AM

This is usually caused when frames are being used to control flow rather than time. If you are do things that depend on time in Update() without taking time into account, things like this can occur. If you want to time things by frame, you can move your code to FixedUpdate() instead, but it is usually a better idea to use Time.deltaTime.

 //Frame rate Dependent(Bad)
 Update()
 {
   //Move 1x/frame
   transform.position += new Vector3(1,0,0);
 }
 
 //Frame rate Independent
 Update()
 {
   //Move 1x/sec
   transform.transform.position += new Vector3(1,0,0) * Time.deltaTime;
 }


Comment
Add comment · Show 4 · 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 keyp3r · Dec 02, 2013 at 01:56 AM 0
Share

I'm already doing this. Thanks though!

avatar image Spinnernicholas · Dec 02, 2013 at 02:13 AM 1
Share

It looked like you might have, but you didn't post any code. It is a very common rookie mistake.

It makes sense that Application.targetFrameRate does nothing if everything is controlled by Time.

avatar image keyp3r · Dec 02, 2013 at 02:35 AM 1
Share

Yup, but when you're grasping at straws... Either way, I have all sorts of slow down on death, and pausing, etc going on during the game, so everything HAS to be time dependent. Turns out (as I state above) it's linked to the refresh rate of the monitor. $$anonymous$$oving the game from a 120hz monitor to a non-120hz monitor fixed it.

avatar image mchts · Aug 13, 2017 at 11:52 AM 0
Share

I use Time.deltaTime in almost every update function but when i build my game to mac_standalone it runs way more slower than windows_standalone. And as long as i knew a macbook air screen refresh rate is standart 60Hz. Since the testing app runs on an editor, can i say its all about my machine's hardware capability or is this the same performance i will get when i build it to an ios device? Cause i dont have a licence to test it for now and at some point im gonna have to continue developing game on a mac to publish it for ios devices.

avatar image
1

Answer by Grarafka · Jun 25, 2018 at 09:45 PM

the code by @clunk47 fixed my issue. thank you!

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

21 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

Related Questions

Is there a way to speed up the game more than 100 times? 1 Answer

How can I make a GUI element move independently of the frame rate? 1 Answer

Real elapsed time since frame begin 1 Answer

CPU usage, fps and colliders 0 Answers

FPS alternate each time I run my application. Sometimes it's 100, sometimes its 500... 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