My Game lags And Is Very Slow

My 43mb UNITY game lags too much when i test it on my phone but my phone works well with big big games like Mortal Kombat X. How can I fix this?

Start by profiling your game to find out what is slowing it down:

The Profiler says Camera Renderer and Gfx.WaifForPresent uses most of my CPU.
What should i do?

1 Like

Well, welcome to the world of mobile app optimization!

For starters, are you using realtime lights? Those are very expensive on mobile and you should try to bake as much lighting as possible.

Are you using high-quality realtime shadows? Kiss performance goodbye if you use many of those.

Are you running many Update() functions in scripts? Time to learn how to code with performance limitations in mind.

Are you using Occlusion Culling? That can help on rendering fewer meshes.

Are your models too complicated? What’s the tris/vert count of your scene when playing?

Are you using fancy shaders, especially those reflective and transparent ones, or even the Standard shader? Time to look into the Mobile > Diffuse shaders.

3 Likes

OK, I remove some of my codes from Update and kept them in start, i enabled occlusion culling, kept my directional lights to baked, removed some of my camera enhancing scripts and kept the ready to minimal or none, I reduced the subdivisions of most of my meshes so they have less polygons but it’s still slow. I also removed shadows completely

Any other advice???

Could you provide a screenshot of the profiler and maybe some of your scene, so I can get an idea of how complicated it is? Also, did you actually bake the Occlusion Culling and lights?

Can i sent that as a Private Message?

Sure, no problem!

Here Are The Screenshots Of The Profiler

Sorry it took so long, the site kept telling me I’m not logged in

Do you need more images?

Also, after taking your advice, the gameplay became a little faster, but still has a little lag in it.

Yes, I see those 150ms CPU spikes. Judging by the screenshot, are you using the Unity terrain system for the ground and grass? I see in the profiler that your scripts are fine; it’s the rendering of the scene that’s taking a toll. So that’s good news.

You should read this as well: https://docs.unity3d.com/Manual/MobileOptimizationPracticalGuide.html

No !
1You cant choose obj file because unity will very slow camera and etc convert them for example with iClone 3DXchange v7.01 Pipeline to fbx only!
2You must acclusion your camera !
3Chage size your texture with Advanced JPEG Compressor.
4Change your build setting like my picture.!

Your came wil be high speed.

This is kinda usless, since it doesn’t say what object or what exactly is causing the problem. If you have 200 trees and you game doesn’t lag and then you place 1 more tree and you get 201 trees. Then you game lags, so you remove say 10 trees, now your game lags even more.