Android Performance Issues
Hello guys,
I am relatively new to unity and I am trying to make a simple game in unity as a university project. The game is just a simple maze in a cave, with some obstacles, key/door puzzles and other irrelevant stuff.
My problem is, that the game gets very slow and laggy when I try to run it on my android device. I tried it on two devices (OnePlus X and OnePlus 3) and both are equally slow. Also, I used the profiler on my PC to find the problem, but I simply just can't. Using the built in android GPU and CPU profiler (onscreen display from developer settings) I found out that the GPU is doing too much work.
Some more information on the project: My main scene is a map containing many stones stacked for building the cave, some torches (around 50 torches with 2 particle systems ... around 80 particles per torch), and a terrain. Also I am using the standard unity first person controller.
What I already tried: I set the quality in the quality settings to "fastest". I also disabled all shadows, filters and other stuff which could have negative impact on the performance I changed all camera clipping panes to the minimum (about 200 on far) I tried to disable torches and/or stones/gameobjects but it did not help The rocks/stones I use from the cave are from the asset store. I compressed all used textures for android to the smallest size possible. * I changed the shaders of my particle systems to mobile shaders.
Here is a screenshot of the profiler running on my pc:
What am I doing wrong? Can somebody guess the problem?
Thanks for any help in advance, Denis
Answer by AurimasBlazulionis · Jan 09, 2017 at 09:58 AM
So since it is a GPU problem, you will need to check how many vertices are being drawn. In game view, press stats. 1 million is the maximum a modern phone can handle. To solve that, use LODs.
Also, try to look how many SetPass calls are. The lower the number, the better. You can open frame debugger and see what takes the most draw calls. Transparent objects are the performance killers on mobile. Transparent objects are only being drawn in forward queue.
Lastly, image effects are terrible on mobile. Try to use as few as possible.
HDR and linear rendering also come at a cost, but it is not that significant.
You can also experiment setting different global shader LOD levels to see if that has something to do with actual shaders.
Remember to accept the correct answers so others can easily know the solution.
First of all thank you for your helpful answer.
Indeed it was an image effect (depth of field) which was causing the problems in my starting scene (game menu)...
In my main scene (the game itself) there are probably just too many vertices (1.8 million)... I think I'm just going to have to reduce the amount of gameobjects used for the cave walls and the roof, as adding LODs seems too complicated for me in such a simple project.