0
\$\begingroup\$

So I've been working on a mobile-based platformer for a few years now. I've spent more than a year optimizing the game for mobile as much as I could. Almost every single one of my meshes are using Mobile/Diffuse shader. When I test the performance of my game (on my phone) with the profiler, the frame rate stays at clean 60 fps for the most part. The CPU time fluctuates between 16 ms and 17 ms. The rendering statistics are also excellent, with draw calls fluctuating between 18 and 25, triangles fluctuating between 1.0k and 2.0k and vertices fluctuating between 2.0k and 3.1k. Below is a screenshot of the Rendering profiler when the game is running smoothly. I believe that for a mobile device, these should be very good numbers.

Stats from Render profiler

However, every now and then, I see a spike in the profiler window (see below):

Occurrence of a spike

According to the profiler, the spike is being caused by Render.OpaqueGeometry.

Render.OpaqueGeometry

Under normal scenarios (when the performance is smooth), Render.OpaqueGeometry takes between 1 ms and 2 ms of CPU time. However, as you can see in the screenshot above, Render.OpaqueGeometry is taking 5.36 ms of CPU time and the total CPU time has jumped to 24.16 ms.

Based on my observations, this spike shows up once or twice per minute. Sometimes, several minutes go by without any spikes. And in very rare occasions, the spike can show up 3 times in a single minute (although I don't think that happened the last couple of times I tested it).

So why do you guys think this is happening despite the game being heavily optimized? I read in a post in Unity Answers that Render.OpaqueGeometry spikes are frequent in all games and it's nothing to worry about. But do you think 2 spikes per minute is too frequent for a simple platformer?

\$\endgroup\$
  • \$\begingroup\$ Try exporting it and checking it there. Maybe they are caused by the editor \$\endgroup\$ – Bálint Nov 4 '19 at 18:53
  • \$\begingroup\$ But I'm not testing the game in the editor. I'm testing it on my phone in Development Build. \$\endgroup\$ – TheSaviour Nov 4 '19 at 19:01
  • \$\begingroup\$ Garbage collector? \$\endgroup\$ – Milos Romanic Nov 5 '19 at 8:44
  • \$\begingroup\$ Nope. I already optimized for gc. \$\endgroup\$ – TheSaviour Nov 6 '19 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.