Lags during tests on mobile SpriteRenderer.RenderSingle

I am testing my 2D game on mobile. On Android LG2 mini I get very good results, but on Android Lg e430 (it’s older phone but still - 512 mb RAM, 1.0 Ghz CPU) I get lags and FPS go down from 30 to 12-20. They are back to 30 after a while, but it shouldnt happen.

In profiler when I have my phone connected I see that SpriteRenderer.RenderSingle is abou 15 % and SpriteRenderer.RenderBatch is 5-20%.

I have one GameObject with SpriteRenderer and simple animation attached to it on the Scene + Background.
Sprites are singleSprites and set them to Compressed 256/256 (I lose quality but I wanted to be sure what causing a lag…)
I suspect that I did something wrong with Sprites… :wink:

Hi @kunmateo1993

Unity tries to force maximum resolution on builds. However, mobile devices have little screens so there is no need to force game to run HD or Full HD. Try to add one of your scripts’ Start method this line:

Screen.SetResolution(480 , 600 , true);

You can change resolution values if you are not comfortable with these ones.

You can also set resolution dynamically by getting devices hardware properties (Like if ram is below some value, set resolution that value)

I hope it helps.


I have found that doing the following corrected lag issues I was having with Android devices:

Under Project Settings - Quality, make sure the profile being used for Android (Item highlighted in green) have V Sync - Every V Blank. For a simple 2D game you can use the Simple profile, by default Fast, Fastest and Simple have V sync to Don’t Sync…which in my opinion for Android devices is wrong.

Under Project Settings - Player, make sure you have Android tab selected, go to Other Settings, Uncheck Auto Graphics API, and make sure only OpenGLES2 is added

Also make sure all your sprites are prefabed, more so if you use them more than once in your scene