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
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
}
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.
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.
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.