- Home /
Device.Present or GFX.WaitForPresent
working on simple Android 2D Game.(Unity Personal Edition)
GFX.WaitForPresent or Device.Present are huge. Every time it´s different, some day it´s Device.Present and other day it´s GFX.WaitForPresent.
I´ve been facing this problem for quite a while now and I thought i´d get rid of it when I am finished with the project. But.. I just couldn´t there was toooo much lag every time I built and ran. I´ve tried litterarly everything, there is no need to count all the things I tried, I can just tell you I followed this website http://atilkockar.com/on-unitys-gfx-waitforpresent-problem/ And I´ve probably seen every single question wondering about Device.Present error.
So I litterarly gave up on trying I know that this is one of the most searched errors but I was wondering if... (ALSO - I created a new project, changed the player settings to (com.productname....) set the built settings to android and profiled the game. Guess what.. device.present was at 70%) anybody fixed this error or should I say bug, and is there ANYTHING else to try?
If anybody reading this post is too building a 2D game for Android, I was wondering if he could screenshot all his main settings. Couse that would probably the only way to find the solution.
Thank you for reading!
I doubt that since it would be a completely different project. $$anonymous$$aybe showing screenshots of your game statistics window, profiler CPU and GPU might help. Have you gone over these?
https://docs.unity3d.com/$$anonymous$$anual/OptimizingGraphicsPerformance.html
Ah, sorry for not being clear what I said is.. I did create a new project and device.present was at 50-70%... and I was asking if anybody found the error thats why the parenthesis..
either way that´s the profiler with all my game objects deselected except for the main camera.
[1]: /storage/temp/81101-profiler.png
As you can see Device.Present is huge besides that, good thing to mention is there is target framerate jumping up to 50% about every 15 seconds.
And yes I have gone over this but obviously the problem is not in the game there has to be something wrong with my settings, If you want me to screenshot anything else just say it.. Thanks
Answer by AurimasBlazulionis · Oct 28, 2016 at 09:11 PM
It will not go away. It is something that can not be profiled. It has to do something with V-sync as far as I am concerned (and vsync is forced on, on android). You should provide screenshot of the profiler window in your actual project, not the empty one. But if you look at the time how much it takes, it is really small. just 9 milliseconds. That means you can still get up to 100fps.
You can see it is still 9 milliseconds which is very small hit (16 milliseconds = 60fps). And there is not really much you can do about it. As long as you keep your code not to use more than 5 milliseconds, you will be fine.
Also, it all depends on the device you are testing on.
After your question I realized that I really was running make game on 60fps and the problem was I was instantiating my obstacles every 1.5 secs and they looked very laggy so I created a pool system and recycled them and that works fine now, thanks!