• 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
0

Answer by iMouath · May 17, 2018 at 06:32 AM

I was able to fix mine by closing EVGA Precision XOC

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.

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

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

Shader not refreshing after changes 0 Answers

Find all materials using a specific shader 1 Answer

Can i trust the Unity shader compiler more than i can trust myself? 0 Answers

Game works in editor, not in 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