A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Now in Beta! Get 1:1 live lessons on any Unity topic or help troubleshooting your project – Connect with an expert on Unity Live Help
Discussion in 'Editor & General Support' started by iverson, Apr 19, 2011.
Device.Present (Total) 32% (Self) 28%
what's the problem?
well, Device.Present may wait for vsync(vblank) - so it is just sitting there doing nothing ;-).
Two main reasons are:
you are too fast - refresh rate is 60hz and you are ready after 10ms - 6ms you need to just wait
you are slightly too slow - same as before - but you are ready after 20 ms - you will wait 13 ms (up to 33ms = 30 fps)
the only one interface for frame rate is "Application.targetFrameRate" in unity,is it the key?
as you're right,the frame rate is low,because there are 500 character in my scene,but they are invisible.
i have to optimize 500 character in a scene.
well, that's sligtly different
in QualitySettings there is a checkbox: Enable VBL (or something like that) if that is checked your fps will be aligned with monitor refresh rate (that's what VBL stands for). Try to disable VBL and profile once again
thanks man, it worked.
I've got the same issue on my iPhone4. Only I don't have VBL on and the Device.Present function is consuming 81% of the frame! This pushes my frame rate to 10-15 fps even though the rest of the game is running in under 8ms...
Could it be a shader problem or something on the iPhone?
you should have posted it in ios section
on ios you have forced VBL
and on later ios versions high Device.Present indicates that cpu waits for gpu (this counter will be updated in 3.4) meaning you are gpu bound
Thanks, this is what I thought.
Hi, guys. From previous posts I understand that Device.Present is a process of waiting. But it slows my iPad from 5 to 15 fps and what am I suposed to do with it?
@Antony Blackett and @WhiteDevil, did you guys learn anything new that could be added to this discussion?
I can't figure out why my main menu screen is running at ~40ms per frame on an iPhone 4 yet on an iPod Touch 3GS I get 30 fps - and this is with having cut the screen right down to just a single button graphic on the iPhone 4.
According to the Unity profiler the Device.Present is the culprit, but as mentioned above by @Alexey, I am GPU bound? I can't see how.
I can't figure out what is the problem with Device.Present.
I have a sluggish screen update in all my projects, with Vsync or not, and these "lags" are sync with the Device.Present component in the Profiler.
Even with the simpliest scene : 1 cam and 1 cube with a transform updated per frame.
It's annoying me since I thought it was something related to Camera and LateUpdate at the beginning..
device.present will be here because ios can't run faster then 60fps [or actually kFPS set up in AppController.mm] - so it basically shows you that you are waiting gpu to start new frame.
I did find out something which helped me - I was rendering a couple of big invisible quads via a third-party plugin.
We solved our biggest "device.present" issue by simplifying our shaders
The device.present problems you see here are caused by overdraw - stop filling the whole screen with transparent / ui and you are likely going much faster.
iPhone4 / iPod Touch 4 / iPad1 have the same gpu as the 3gs generation but 4 / 5.2 times the pixel to render which the gpu is simply barely capable of doing -> alpha is a very bad idea if not used correctly, fullscreen effects are a no go and big particle systems will kill you too
I've been struggling with this for quite some time... I've read this thread, and many others around the forums... but I just cant understand what is the problem.
Here is my scenario: We are developing a 2D game, and the menu was running at 16 fps (with targetFrameRate set to 60) on the iPad 1. I profile it and Device.present is the villain. There is a lot of transparency on the menu, and 4 layers of background at different speeds, which adds up to a lot of transparency over the other. Anyway, reading about it, we made some changes, cut images into smaller ones, etc, and got to 24FPS, which is still bad. Then, after reading some more... we decided to do it other way... we modeled planes in the right shape for everything, so there is NOTHING transparent in the scene. The scene itself has 900 triangles with 8 simple objects, 4 different materials (all unlit), no overdraw (according to unity overdraw view), no scripts at all... and on the iPad 1 I still get only 45 FPS, which is good, but its not the possible 60 fps. On the profiler, the villain is still Device.present.
If it were just for the menu, it would be ok, 45 is good, but I would like to understand why Device.present is still killing 1/4 of my fps for nothing, so I can improve other areas of the game that I am having the same problem.
Thank you for your attention,
Have you turned off VSync? (I don't know if that's even possible on an iPad...)
Assuming that VSync is on and the device is running at a 60Hz refresh rate, an average of 45FPS sounds like you're hitting every one-and-a-half frames (i.e. you just miss the first vsync and so present on the one after it, and then hit the vsync after that, repeat ad infinitum).
It may also be that Device.Present is flushing buffers or something - a double-buffered GPU has to finish drawing to the backbuffer before it can present it as the front buffer, so if Device.Present is blocking then it may be because it's still drawing.
Yep, VSync is turned off (at least on the quality settings)
The real problem is that on the Menu we get 45 fps~, and on the game, we get about 45-48fps, but the enemies move as if they were lagged... its not a natural movement... initially they fall using rigidbodies and gravity until they reach the ground, and the fall is "laggy"... that is why I am concerned about this. This doesnt happen on any other device we`ve tested, the game runs at 60fps on iPhone 3GS... but feels laggy on iPad 1... =/
same here don't understand
I have created a test 2D project which consists just of a camera and a sprite (200Kb png image). The sprite has a rigidbody and a script which rotates it when a user touches the screen. So the longer user touches the screen, the faster the sprite rotates. I run it on an average Android 4.2.1 device (Lenovo P780). This runs mostly 60 fps but the frame rate drops to 30 every 3-5 seconds for couple of moments. When this happens, Device.Present takes 80% of farme execution time.
My project quality settins are set to Fastest, meaning that vsync (and a bunch of other stuff) is disabled. But yet the frame rate drops because of Device.Present.
I have also tried Tower Defence example on the same device, with Fastest quality settings, and it runs on 35-40 fps, dropping to 15-25, again because of Device.Present.
I have downloaded a couple of non-Unity, pretty intense 2D games from play store and they seem to run solid 60 fps on the same device. On the other hand, all Unity android games which I tried felt a bit luggish: playable, but definitely not 60 fps. I wonder if they all suffer from Device.Present too...
Is there any solution for this Device.Present issue?
I also have Device.PresentAndSync showing on profiler that takes much time to process.
I have 40k verts in my scene and just 3 different material, they all use mobile/diffuse material and 256x256 compressed textures.
I still have 28-30 fps either on s3 and galaxy tab 2014 edition.
I also have that device.present taking a maximum of resources (Total 86,3% Self : 85,6% !) on two of my scenes when I build and profile my game on Android. (with Vsync turned off or on, it doesn't change a thing)
The first scene has only one canvas and 4 ameliorated buttons (meaning they are constituted of 4-5 UI layers). it runs, without animations at 20FPS. Quite ridiculous...
The second scene uses a canvas too and a Pie from the "graph Maker" addon and run at approximately 30fps with one pie only and no animation. Ridiculous Too!
The enigma is that I really don't underestand why those two scenes are doing that. My 4 other scenes, which display much more gameobjects run their 60fps.
I'm working to understand why. I'll post here my eventual discoveries (if there is any)
First solution :
On one of my scene, it was an UI Image that was stretched which was doing the big mess.
I found out that, if it was stretched (in any directions) with a bottom or a top NOT at zero, it was okay. But with all the values at 0 (left-right_top-bottom) : Boum, slow down "device.present" in the profiler.
The solution in this case was to make a Sprite and a camera to replace my UI image that i wanted to stretch as a background image.
It looks very much like a bug to me. I'll post that to the Unity dev team.
For the other scenes, the problm seems different... still working on it.
Here is what woked for me: I had more than one camera in scene, but while they all were enabled i had this "Perfomance hits", but when i disabled each of them except one i need at current moment, this problem disappeared.
Hey, I have the same issue here.
A game runs on iOS iPod 5th generation shows major performance impact caused by Graphics.PresentAndSync.
As you can see, Camera.Render finished within 6ms so the rendering isn't the issue. Same game runs smooth on iPhone 6, only iPod causes the problem. I turned off VSync, change Graphics API from Metal to OpenGL ES 2.0 but no success(It looks like iPod only supports OpenGL ES 2.0 anyway)
When I run the game on iPod through XCode, output panel shows these warnings :
WARNING: Shader Unsupported: 'Standard' - Pass 'FORWARD' has no vertex shader
WARNING: Shader Unsupported: 'Standard' - Pass 'FORWARD_DELTA' has no vertex shader
WARNING: Shader Unsupported: 'Standard' - Pass 'SHADOWCASTER' has no vertex shader
WARNING: Shader Unsupported: 'Standard' - All passes removed
UnloadTime: 21.868374 ms
On iPhone using Metal doesn't show these warnings. But I don't use Standard Shaders anyway, so... What can be the problem??
Yeah, I have the same issue! Any solution?
To me it was my custom shader (for tutorial screen with rounded-box holes) causing it (around 60ms of it).
Apparently this happens because of CPU related performance issues. In my case, I was using a SphereCast on Android in the FixedUpdate of a single object. I removed that and I got 60 FPS.