• 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 Michael-Thomas · May 07, 2016 at 12:21 AM · performancegpuvsyncminimize

VSync + minimized game uncaps the framerate

My game is setup to use Vsync "Every V Blank". And when the game is running normally, this is working correctly and the framerate sits right around 60 fps. However, when I minimize the game its framerate shoots way up and my GPU usage shoots to 100%.

Application.targetFrameRate is ignored (as documented) because vsync is active so this is no help.

For reference, I'm running Unity 5.2.2 but I see no relevant items in changelogs since then.

Has anyone else noticed this? Are there any good solutions/workarounds? And/or is Unity aware and working on a fix? It's really not ok for my minimized application to be using our players' entire GPU but right now I'm not seeing any way to solve this.

Thanks in advance for any suggestions!

Comment
Add comment · Show 4
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 Deadcow_ · Aug 22, 2016 at 12:30 PM 0
Share

Did you have any luck to resolve this?

Show more comments
avatar image incorrect · Aug 22, 2016 at 06:44 PM 0
Share

Have you tried submitting a bug?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Aug 22, 2016 at 11:48 PM

You can at any time manually force a slower framerate. Just call a Thread.Sleep() with a small time whenever Time.deltaTime goes below a certain threshold.

 void Update()
 {
     if (Time.deltaTime < 1f / 70f)
     {
         int ms = Mathf.FloorToInt((1f/60f - Time.deltaTime)*1000);
         System.Threading.Thread.Sleep(ms);
     }
 }

Thread.Sleep will reduce your CPU load. Thread.Sleep is not very accurate as it depends on the CPU load. I just calculate the remaining milli seconds to the target framerate of "60". I round down that number since in most cases Thread.Sleep will take a bit longer than the given rate.

Doing this will make your frame rate very jerky, so make sure you set the threshold "low enough". In the example i used a rate of 70 fps.

ps: The reason for this problem is simple: Since the graphic context is no longer visible, it isn't redrawn at all. So waiting for the vsync doesn't work.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

64 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

Related Questions

Android 30 FPS cap on minimal/empty scene 0 Answers

High GPU Usage 2 Answers

Question on iOS iPhone4 GPU Frame Time 0 Answers

Necessity to make spritesheets, texturesheets, tilemaps. 0 Answers

Why so much GPU usage for an empty scene ? 0 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