I'm looking for a way to reduce rendering time for my Game Over scene. A quick look of the scene components is like this:

GameOverScene Mockup

All yellow objects are UIButton, texts are all UIText, white areas are all UIImage (including the background). The friend list is a Facebook friends list contained inside a Scroll View. All object are inside a Canvas that resizes to the camera.

I noticed the problem firsthand when playing the game on Android. This game over scene is running at 15fps (while the main game play scenes are all running at nearly 60fps). The phone is a HTC One. On my cheap LG phone the game simply crashes at this scene.

Profiler shows Camera.Render() taking 70~90% of each game loop.

The iPhone5 & 6 on the hand is quite interesting, fps show no real difference between gameplay scenes and the gameover scene, both running smoothly at ~120fps. Still Camera.Render() was taking 40~50% of each loop in GameOver scene vs ~20% on GamePlay scenes.

Quite strange considering the fact that HTC One specs and iPhone 5's are quite similar.

I think the problem is because of the large number of UI Components on the GameOver Scene, since sprites on gameplay scenes are all batched (it's a 2d game). So I suppose I must find a way to reduce draw call on all those UI components. I thought this should be a common problem, but strange enough I've been searching for weeks without a sounding solution that actually work.

  • I've tried to check all UI objects static: doesn't show any notice-able change. On the other hand, Scroll View's contents are what's taking the bulk of the rendering (a long friend list), and I can't mark them as static because they do move.
  • Canvas pixel perfect off: already done that from the beginning.
  • Move the Scroll View to a separate Canvas: only improve performance when I'm actually scrolling scroll view, otherwise no change. And - could be I did something wrong - the scroll view doesn't work on Android anymore.

TL;DR; Question: Please guide me to reduce rendering time on scenes with lots of UI elements.

  • 1
    \$\begingroup\$ How many friends you are getting? Secondly if you share some code then we can discuss further \$\endgroup\$ – Hamza Hasan Dec 11 '15 at 6:05
  • \$\begingroup\$ Hello, at the beginning there's a fake friend list with 7 items, and that's what I'm profiling on. Actual friend list length depend on the number of user's friend playing the game. Let's imagine it would be Facebook's maximum friend limit of 5000 because my game surely will become the next Flappy Bird like every game made by newbies for the last 2 years :) I could surely share my code but it's mostly drag&drop in Unity Editor, so I don't know how to share. \$\endgroup\$ – AVAVT Dec 11 '15 at 6:08
  • \$\begingroup\$ It is really very difficult to figure it out in limited information because i believe that there would be something else causing the problem. Well, it could be image size, image materials using what shaders, so on... \$\endgroup\$ – Hamza Hasan Dec 11 '15 at 6:12
  • \$\begingroup\$ I keep hearing people complaining about UI and preferring GUI. I'm one of them. Just saying. :) \$\endgroup\$ – Nika Kasradze Dec 11 '15 at 7:16
  • \$\begingroup\$ Hello @NikaKasradze, do you mean this GUI. I didn't know it would be possible to this to create game UI. Do you have a link to detailed information? (since Unity docs is terrible) \$\endgroup\$ – AVAVT Dec 11 '15 at 7:20

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.