Occasional Mesh.DrawVBO spike

Hello,
I’m having a problem with FPS drops during gameplay, apparently caused by Mesh.DrawVBO spikes.
My scene is made of ~12 meshes 512x512, about half of them with transparent textures. There are also 2 sprite maps with all the animations, both 2048x2048 with 16bits. The screen usually shows 4-6 meshes at a given time, plus the player character and 1-4 enemies.

Mesh.DrawVBO usually sits between 3-6%, and goes to 60% or more on spikes. Here’s a picture from profiler:

Any idea what might be causing it?
I’ve searched around quite a bit but found nothing conclusive :frowning:

Hi!,

I’m in the same boat. Nobody seems to have a feasible solution for this and it really sucks. My game is fairly simple but can’t have a steady frame rate because of this things :(.

I found an old thread that talks about this but it seems not to contain a solution http://forum.unity3d.com/threads/118723-Huge-performance-loss-in-Mesh-CreateVBO-for-dynamic-meshes-IOS. It is not the same, but realted to your question.

Cheers.

Hi,

i am experiencing the same issue and i already use the solution in the linked thread with the double meshes. It helped, but not as much as switch all my shaders to “Mobile/Particles/Alpha Blended”. I managed to get our Game from 5 fps to a steady 15 which sadly is not enough so i keep digging.

This only happens on the iphone 4 so far.

I’m on Android platform with Nexus 4 device but came across the thread searching for a solution.

I haven’t tried double meshes because I don’t know which object(s) is causing the spikes.
I’m also using mobile shaders.
And I’m not sure if it happens on other apple devices, maybe it does but as they have much more power it doesn’t create a spike, but I’m having the same issue on weak android devices =(

I notice that you have a script CPU spike just before or after the draw spike, it’s possible that this is pushing your overall frame time into 15fps which ( I think would stall the mesh cpu waiting for the gpu by 3 frames or roughly 50-60ms, I’m probably making that assumption up )

Can you do anything to reduce your script load, to see if the spike is the same?

Your skybox for some reason is also super expensive, is it like that every frame? 7ms is a big chunk of time for something in the background that doesn’t move. Know why it’s expensive?

Not every frame. Usually it costs 0.5ms, but it does have occasional spikes also. I’m using the Mobile/Skybox shader, and the image is 512x384 with 24 bits. Is there any cheaper way to do it?

About the CPU spikes, I’ve been working on that recently and got some improvement, but it did not change the draw.VBO spikes.
I’m running more tests right now, I’ll try to post some results later today or tomorrow.

I’ve started stripping down my game to find what’s causing the issue.
After removing everything exempt for the player and the map collision I still got spikes on Mesh.CreateVBO, Shader.SetPass and Camera.Render itself.
Also Device.Present has some spikes up to 90ms!
After making my player a simple square with no transparency nor transparency and my map a rectangle most of them are gone, except for Device.Present. What is this?

After a lot of research I’ve only found one answer on the forums, someone said it was due to overdraw, but that does not seem accurate since I don’t have anything transparent on the scene.

Really appreciate any insights because I have no idea what’s going on.

Also, these are the shaders that I’m mostly using

I wonder if this has been solved, as I seem to be getting a similar issue on Unity 4.6b20.