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 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?

avatar image Michael-Thomas Deadcow_ · Aug 22, 2016 at 05:41 PM 0
Share

Never got any response or found a solution. Now on Unity 5.4 and as far as I can tell, it's still merrily running along at like 500 fps using lots of GPU while $$anonymous$$imized.

avatar image Deadcow_ Michael-Thomas · Aug 22, 2016 at 06:00 PM 0
Share

Damn :( In my case it's about 600-800 fps and it's toasting my cpu. The only way I found is to disable Play In Background option, but... there is one case when with disabled play in background option game is still running... I'm on 5.3.6 and was hoping it's fixed in 5.4 :(

It's strange that most of unity games runs fine and there is not much questions like yours, may be something platform specific

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.

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

High GPU Usage 2 Answers

Android 30 FPS cap on minimal/empty scene 0 Answers

How heavy are animations on GPU/CPU ? 1 Answer

GPU running 100% while Unity build is minimized and running in background 1 Answer

Offloading to GPU 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