Profiler - What does "Clear" mean in depth under Camera.Render

I totally just realized I put this under scripting, can someone move it to support. Sorry

Hello,

I’m developing an android game and I’ve noticed a bad frame rate on my lower end device (kind of obvious). I decided to see what it was all about I have found that every second to every 2 seconds I get a spike which is causing my low frame rate. The spike is from “Camera.Render → Drawing → Clear”. It spikes to 70% - 95% of my total CPU and takes anywhere from 50ms - 65ms.

Everything else looks reasonable, but I don’t understand what clear is. Is this something I can make more efficient?

Any information on what this “clear” is would be great.

Thanks
(Note this is a duplicated message from Unity Answers. I’m posting it on the forums because the forums is more knowledgeable and I don’t think anyone on Unity Answers knows)

I expect that it’s the function that fills the rendering output buffers with default values so that it’s ready for the next frame’s rendering. For an out-of-the-box camera setup that means that the colour values are all set to that blue colour and the depth values are all set to their maximum.

It’s an internal thing, so aside from changing the clear mode for your cameras (depending on what you’re doing you may only need to clear depth) there’s not a lot that you can do. It could be worth checking out your skybox if you’ve got one, but I’m not sure what kind of performance impact that can have.

Also, what are the time values? They’re actually more important than the percentages, which can be misleading in some cases.

I am using a skybox so changing the clear mode isn’t really possible. As for cameras go I only have one.

As stated in the first post my times range from 50ms - 65ms per spike for “clear”.

For testing purposes I changed my clear to depth only and I still get the spikes for about the same values.

What’s the device? And do you get similar values (in ms) for clearing when you deploy an empty project?

The device I’m experiencing this on is a Motorola Droid x2. I do not have this problem with my Samsung Galaxy s3.

I always noticed the lower frames per second on my droid x2 but I assumed it was just due to the fact it’s an older device.
After looking at the profiler and seeing that everything executes at about 16ms (equaling out to 60FPS) and then I get huge spikes of 50+MS due to this “clear” under Drawing my assumption was it was some performance issues I have within my project.

So I didn’t do an empty project but I did an empty scene.
So it appears it still happens. Not as often and not as long but it is still happening. In a span of ~300 frames (running at 60 FPS) I get 4 spikes. One is 86% @ 13ms, one is 86% @ 19.4ms, 89% @ 20.7ms, and 38% @ 11.34ms.

So the times are much less in comparison but still getting the spiking, even on an empty scene.

One thing that has me baffled is all the values from my first 2 posts are on my main menu scene. I get horrible spikes on this scene as I already described. Now on my level 1 and level 2 scene I still get spikes but not as bad. The spikes on my level 1 and 2 scenes are lower then my menu scene but higher then this blank scene example. What’s even stranger is my level scenes have more going on on the terrains, more draw calls, more vert/tris, more animations, more skinnedmeshes, and more scripts running.
Why is a more complicated scene have better performance?