Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
11
Question by YourGamesBeOver · Jan 23, 2016 at 06:45 AM · shadereditorlagbug-perhapsvsync

Gfx.waitForPresent causing massive lag spikes in editor

Something is causing the editor to get unusably low framerates in the editor. Using the profiler, I can see that Gfx.waitForPresent is spinning for around 100ms at each lag spike. Now, I've been around Unity for a while now, and I know that Gfx.waitForPresent is VSync, but no matter what the target framerate is, it should never have to wait 100ms between frames. Here's a screenshot of the profiler on an empty scene in a new project when I just try to move the editor camera around: alt text

This is a brand new system, here are the specs if that might help shed some light: - i7-6700k - GTX 980Ti - 16GB RAM - NvMe PCIe SSD - G-Sync monitor (2560x1440@165Hz)

I have already tried changing pretty much every VSync/G-Sync related setting I could find. Any ideas would be appreciated

waitforpresentspike.png (93.6 kB)
Comment
Add comment · Show 11
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 SterlingSoftworks · Jan 23, 2016 at 07:27 AM 0
Share

Do you have anywhere in your code where you're setting Application.targetFrameRate(xamount);? This can cause the dreaded waitForPresent.

I know you said you've messed with VSync but when I set $$anonymous$$e to "Don't Sync" this issue went away.

avatar image YourGamesBeOver SterlingSoftworks · Jan 23, 2016 at 08:12 PM 0
Share

this is an entirely blank project, I haven't written any code yet.

I was just messing with some other stuff, it seems that switching to DX9 ins$$anonymous$$d of DX11 fixes the problem. Not ideal, but it works for now until Unity can fix this bug

avatar image SterlingSoftworks YourGamesBeOver · Jan 23, 2016 at 08:14 PM 0
Share

Ah gotcha.. Just making sure all the things that were effecting my game were not doing the same for you! :)

avatar image nathanielxiao · Mar 07, 2016 at 09:35 PM 0
Share

same issue here with same CPU and GPU. Sad

avatar image NinjaISV · Dec 23, 2016 at 01:50 AM 0
Share

Why has Unity not addressed this issue yet!? It's causing me a massive headache trying to solve it, even an empty scene has it!

avatar image Mafutta · Mar 24, 2017 at 10:56 PM 0
Share

I don't have Graphics Jobs (Experimental) checked, yet still see 63% Gfx.WaitForPresent. I also don't even have a GPU. See attached. Any ideas?alt textalt text

playersettings-v11126.png (67.1 kB)
gfxwaitforpresent.png (248.6 kB)
avatar image tanoshimi Mafutta · Mar 25, 2017 at 08:07 AM 0
Share

You don't have a GPU? Quite impressive that you're managing to render anything to the screen, really.... You mean you're using an integrated graphics card? Then that probably explains why the CPU is always having to wait for it to be ready. You might want to consider investing in a dedicated graphics card and your problems will go away.

avatar image Mafutta Mafutta · Mar 25, 2017 at 12:07 PM 0
Share

Thanks for advice, I do plan on getting a proper machine but wanted to see how far I can optimize without. I was actually able to get up to 60 fps yesterday. I do run on linux which helps.

avatar image Lee7 Mafutta · Sep 26, 2017 at 06:17 PM 1
Share

" I do run on linux which helps."

lol, no it doesnt.

DirectX is lightyears ahead of that garbage OpenGL.

Show more comments

7 Replies

· Add your reply
  • Sort: 
avatar image
14

Answer by pophead2 · Nov 08, 2017 at 02:35 PM

Turning off NVIDIA IN-GAME OVERLAY seemed to work for me. alt text


in-game-overlay.png (32.0 kB)
Comment
Add comment · Show 6 · 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 baabeuf · Nov 21, 2017 at 10:18 AM 0
Share

Worked for me too.

avatar image marcmong · Dec 23, 2017 at 03:18 PM 0
Share

This fixed it for me! Thanks!

avatar image Skegon · Feb 24, 2018 at 10:27 AM 0
Share

Awesome! Thank you! I have had this problem for so long, and couldn't figure out what caused it.

avatar image GameDev_Chuck · Mar 21, 2018 at 12:17 AM 0
Share

I was afraid this might be the issue. It was great for screen caps and working fine up until last night when I made the mistake of installing updates. Now my fps is absolutely tanked unless this is disabled... Woe is me.

avatar image mahdi_jeddi · Mar 28, 2018 at 04:23 PM 0
Share

100 times this! Thanks!

Show more comments
avatar image
3

Answer by DarnVisages · Nov 07, 2017 at 12:42 AM

I found a solution for my computer. If you have a laptop with an NVIDIA GPU, check if the problem only happens when you have the AC unplugged. If so, open Geforce Experience and go to Settings > Games. There's a setting called "Battery Boost", turn that off completely or move the FPS setting within it up to 60 FPS.

alt text


2017-11-06-17-40-24-geforce-experience.png (25.9 kB)
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 JeromeJ · Mar 06, 2018 at 08:23 PM 0
Share

Fixed it for me! Huge bottleneck while being unplugged and nothing else could fix it.

avatar image
2

Answer by NinjaISV · Dec 29, 2016 at 06:34 AM

I believe I have found the solution; it worked on my project at least! This "Gfx.WaitForPresent" was being caused by a tiny checkbox in the "Player" settings. Uncheck "Graphics Jobs (Experimental)" and you should see that "Gfx.WaitForPresent" has either been completely removed or at least greatly reduced.

alt text

alt text


gfx-1.png (121.8 kB)
gfx-2.png (50.2 kB)
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 siddharth3322 · May 10, 2019 at 02:02 PM 0
Share

This is by default co$$anonymous$$g unchecked so this is not a point.

avatar image
1

Answer by qulol · Dec 29, 2016 at 06:16 AM

Try Edit --> Project Settings --> Quality and V Sync Count to Don't Sync.

Gfx.waitForPresent is like the CPU is waiting till the rendering process is finished.

If the problem still exist u should check ur renderprocess in the profiler wich takes much time.

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

Answer by johnsolo · Apr 04, 2019 at 08:26 PM

If you are on MacOS disabling Metal might help with this. My Mac mini with integrated graphics was chugging along on simple scenes between 45-60fps. After disabling Metal my FPS is in the hundreds!

Project settings > Player > Other settings > Rendering > Auto Graphics API For Mac (uncheck) Then drag OpenGLCore above Metal in the list.

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 andywatts · Apr 09, 2020 at 12:07 PM 0
Share

Thank John Solo!

  • 1
  • 2
  • ›

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

66 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

Related Questions

HUGE Lag spikes in editor when playing an animation. Over 400ms GC.Collect (profiler screen included) 2 Answers

Unity capturing events in editor and not letting go 0 Answers

Using ScreenCapture.CaptureScreenshot freezes Unity Editor (2019.4.26f1) 0 Answers

Shader does not display properly in game/editor view, but building it works. 0 Answers

Unity lag when play but not when build 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