- Home /
how i can fix lag in my android game?
hi everyone! i make an android game in unity, and I have lots of lag in my game while testing in my phone.How do I fix this? how i can fix lag in my android game?
Answer by DripSta · Apr 21, 2020 at 01:07 AM
There is no for sure way to fix the lag because it differs from one game to another. Here are a few suggestions 1. Try baking your lighting data onto your your assets so that it doesn't have to be calculated every single frame at run Time. There re many videos on Youtube that can assist you with that 2. Try using static batching by marking your assets in the scene as static for batching. Again there are many tutorials for that on Youtube 3. Also try enableing GPU Instancing on the materials of your assets( its a checkbox on the material once you have selected the material, everything about the material will appear in the inspector, including GPU Instancing) 4. Try using an occlusion system in your game if it is necessary, I mean what the camera doesn't see shouldn't be rendered and that is what the occlusion system does(disables gamesObjects that aren't been seen by the camera) 5. If your using a terrain be sure to tick the checkbox of GPU Instancing on the settings of the terrain(the terrain's own settings that will be visible in the inspector once you have clicked or selected the terrain either in the scene or hierarchy view) 6. Try using a LOD system for all your gameObjects in the scene. There are lots of videos on Youtube that can assist with that 7. Check your scripts an ensure that you never left a "Debug.Log" or "print" message on any f the scripts because these statements can cause your game frame rate to greatly drop 8. If you seriously want to get the best performance as far as you scripts are concerned, consider writing your scripts using unity DOTS, meaning writing coding as ECS representation. There are videos on Youtube that can assist you with that 9. The ultimate way to really optimize your game is to use unity's Profiler in order to find out what is causing your game to lag in the first place, and finding the problem basically means that your half way done with solving the problem. So that you can know where to direct your attention to when optimizing your game. There are many video tutorial which can help you with that on Youtube
Your answer
Follow this Question
Related Questions
How do I prevent / deal with input lag on a touch interface? 3 Answers
Unity to android (game very laggy) 1 Answer
Bad Performance on Mobile. 0 Answers
Lag after change scenes on Android 0 Answers