Hi Everyone,
after two weeks of running into the same problem, reading every forum post, watching ever unity optimisation video tutorial and so on - I’ve finally turned to the community.
Situation: building a seated VR game as a learning experience/exercise in frustration.
I had been on holidays, so using my trusty 2013 Macbook air, I bought some assets and started building my simple environment and was able to get about 30 frames per second, with the occassional wait for present spike - pushing up over 100ms. I wasn’t too worried because this old machine wasn’t my target hardware, but it was fine for some of the early scripting stuff I wanted to get out of the way. When I got home, I fired up the big laptop - Alienware powered with a 1060, turned off v-sync and tried to run my scene. While I got better performance - I’m still getting “wait for present” spikes up to about 25ms.
To my eyes, it looks like the render thread is causing the mess - but I just don’t know. I’ve uploaded a screenshot from the profiler, looking for a way to upload the raw data next.
I have tried literally everything I could find on the topic, with no joy. Hoping someone here can see what I’m missing.
Does the same thing happen with a completely empty scene?
If not, then at what point does it start happening (meaning after which assets get added to the scene)
Ignoring the spikes for a second, you mentioned that you have VSync off, but it looks like that you are still capped at 60fps in that empty scene.
If you have really turned it off in unity, then the only thing that can force vsync is the driver, so maybe take a look at that as well.
Anyway, even if you get the expected 5000 fps or so with a completely empty scene, the spikes are still strange.
Even with a fixed 60fps you shouldn’t get them.
They look really periodic, so something must cause the WaitForPresent thing based on time.
Unfortunately I don’t know what else to suggest. I’m using 2017.3.0f3 and when I disable everything in my scene (yes, I know, its not truly empty then) the profiler looks like this: Imgur: The magic of the Internet
I’d accept the argument that it’s the driver, except that I’m also getting these spikes on the Mac and a third computer - so that implies it’s either Unity or the project itself.
ArgumentException: The Assembly UnityEngine is referenced by UnityEngine.UI (‘C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/Standalone/UnityEngine.UI.dll’). But the dll is not allowed to be included or could not be found.
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List1 alreadyFoundAssemblies, System.String[ ] allAssemblyPaths, System.String[ ] foldersToSearch, System.Collections.Generic.Dictionary2 cache, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:156)
UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[ ] paths, System.String[ ] foldersToSearch, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:196)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Build completed with a result of ‘Failed’
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
you tried these, force opengl, and removing extra bloatware apps?
does the laptop has integrated gfx card, tried running on that also?
(although since it happens in your other computers too then it shouldnt be those…)
for me, building completely empty pc.exe project, without scenes or anything, works…
(tried using 2017.3.0p1, havent got it installed on c drive though… but shouldnt matter)
Yes - as I say, clean build - no joy - now rebuilt two computers - no joy. Builds stuff fine on both Macs. Looks like i’m reporting a bug for the build issue. But it doesn’t help me explain the wiatforpresent thing.
Ok - bug report submitted for the build problem. Any ideas on the framerate issue - this wait for present thing that is happening on a few computers? (both my crappy old laptop and my shiny new one?)
Now, I have no idea why this might be, but fixing this problem seems to have had an impact on the framerate and waitforpresent thing.
Here is the empty scene, profiled as a build - this spike comes immediately after switching back to the running build from the Unity editor, things slow down to 91fps in arguably the worst case scenario.
Last post had the raw profiler output for the scene as built. This post has the profiler output for the empty project build and the scene as profiled in the editor. No idea why deleting a Unity index file might fix this - but why worry when I can get back to working on things that matter.