Low FPS because of UI

Hi

I have problem with my game. Everything works very good except UI.
I use Unity UI to show things like buttons, popups, windows to user, but my frame rate fall down when I simply show big popup with transparent black background, white content and some icons + text on the screen.

I noticed that if I add only one white background to the screen it eats from 5 to 10 fps. It is horrible!
Is that really such a big thing to Unity?

What should I do with worse devices?
Is there any way to improve performance and make fps higher? Scaling, quality, building options…, anything?

System: Android
Device: Tablet

If you need any other informations please let me know.

Try to use GUI.DrawTexture in manual.
This code displays big texture on full screen - test and let me know :slight_smile:

public Texture2d someTexture; // small black quad, not transparent

void OnGUI() {
   GUI.color.a = 0.3; // transparent scale
   GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), someTexture);
   GUI.color.a = 1; // not transparent for the rest gui element
}

Hi, thank you for your advice :slight_smile:
Hmm, I use Unity new UI system with Canvases. Isn’t your way be obsolete?

UI system is very easy to use and this is his main goal. UI has has many options but you may be unnecessary. Unfortunately engine doesn’t know of this and uses power. Better make own code only for what you need. In my opinion of course.

On the other hand can I turn off these unneeded options? And can you list all of them?
Sometimes views are complicated, like popup with settings or interactive tutorials. It’ll takes ages to draw everything using OnGUI method. I tried this when it was Unity 4.5, and especially scaling to device screen was horrible.

Try to use some material with transparent shader instead of sprite. Scaled a lot sprites cause significant perfomance drop.

This same problem is with Unity Terrain - easy and nice tool to modification mesh terrain inside engine. Unfortunately he eats many draw calls which they degrades performance. And again, best to do it yourself in other program.

@rchmiel
Do you mean another package like NGUI or another program like Unreal Engine?

I have changed only one background from sprite to material and FPS dramaticlly fell down. So it looks to be even worse solution in my case.

I wrote about the mesh, so I mean 3ds or blender.

How much have these UI ??

In general, using any kind of transparency will eat draw calls. Try to cut down the amount of transparent pixels you are drawing to the screen, for the fullscreen overlay, try using render layers. You can debug draw calls by using the frame debugger and find the reason for your slow down using the profiler.

1 Like

Correct me if I will say false but profiler is only in Unity Pro? Isn’t it?

I spent whole day to learn New GUI and creating new testing scene to comparison. Just look at this:

Unity UI performance:

  1. just screen = 27.5fps
  2. with popup = 17.5fps

NGUI performance:

  1. just screen = 60fps
  2. with popup = 60fps

It was shock for me. Why Unity is so slow and we have to buy other packages just for UI…

  • @rchmiel - I am not very familiar with meshes. Could you tell me what object/component should I use and how can I create it?*
  • @enhawk - Did you mean culling mask on the camera?*

it’s in unity personal 5.x

1 Like

Thank you. I didn’t know that personal have this already. In my case it is all because of Call Draws.