Tuesday, 3 December 2013

Improve performance Unity mobile game

 First I want to say that unity is awesome and cool.

So I assume that you are a well known with game development in general and unity game development at that point.

1. Reduce number of draw calls in your game as much as possible. I mean its quite nice indicator of performance of your game. You can find out number of draw calls in game menu of an editor.
2. Use baked lighting. Baked light is awesome. Here you can turn of realistic ray trace algorithms and archive fast and attractive picture of you game. Every dynamic light source in your scene increase amount of draw calls dramatically.
3. Turn on STATIC property of game object if game object is really static. I mean if its not moving in scene. It helps dynamic culling system to find out which objects to draw and which object is not to draw every frame
4. Destroy game objects if they out of view and will never goes back. Like peace of destructible object that fly away from camera.
5. Use mobile shaders instead of standard shaders for unity engine. It helps you to avoid rendering bugs and may improve performance a little.
6. If your game have a lot of UI do not use standard built in unity GUI system. Use something like ngui or exGUI.  All that libraries was made for you with passion and if they still alive they have less bugs that you will made developing your own system.
7. Tweak such parameters as camera culling distance ans use as much HACks as it possible.
8. Use LOD system in your games. It helps keeps performance of a game on a long distance.
9. Destroy particles or reuse them after they have worked. I know that reusing is much better but sometimes it's not possible to do that.
10. Don't use sub-materials. Each sub-materials generates additional draw calls.   Try to put everything in one texture. I know it's not convenient for designers but life is so.
11. Combine group of objects into one to reduce amount of draw calls if they are not far away from each other.
12. Use FOG with Far clipping plane to remove objects that will be drawn behind it.  It keeps everything realistic and will speed up your game.
13. Be aware of complicated collides like mesh colliders. They kills your performance a lot but pretty sure can be replaced with more simpler like sphere or box or capsule. By the way sphere collider is the fastest one.
14. Use profiler to find out main lags of your game . And reduce them step by step from biggest to smallest.