Optimizing Graphics Performance
Manual     Reference     Scripting   
Unity Manual > Advanced > Optimizing Graphics Performance

This document is unofficially translated by users.Please see the original document here.

Please send e-mail to here, when you have any question about the translation.

Optimizing Graphics Performance

Making your game run smoothly is of prime importance to its success. Thankfully Unity is there for you! We have spent a lot of time and energy making it run fast on a wide variety of hardware. Below are some simple guidelines to maximizing the speed of your game.

In summary - combine, combine, combine

In detail:

Modern graphics cards are really good at pushing a lot of polygons, but they have quite a bit of overhead for every batch that you submit to the graphics card. So if you have a 100-triangle object it is going to be just as expensive to render as a 1500-triangle object. The sweet spot for optimal rendering performance is somewhere around 1500-4000 triangles per mesh.

You only pay a rendering cost for objects that have a Mesh Renderer attached. And you only pay for those that are within the view frustum. There is no rendering cost from having a lot of empty GameObjects in your scene.

It is important to understand that just combining two objects which don't share a material does not give you any performance increase at all. If you want to combine effectively, you need to make sure your mesh uses only one material after you have combined it.

There is one thing to be aware of when combining objects though: if you use a lot of small lights in your scene, it might make sense to combine only objects that are close to each other.

The rendering cost for a mesh that has multiple materials is the same as having multiple renderers for each material. The most common reason why you have multiple materials is because two meshes don't share the same textures. So, if you want to optimize rendering performance, you need to make sure that the objects you combine share textures.

If you want to have the best performance and don't care about Bumpmapping or Pixel Lighting, go to Edit->Render Settings... and set Pixel Light Count to zero. This will simply use vertex lighting for all objects. This means all geometry will be rendered only once per frame. This is an extremely useful LOD setting, so your game can run fine on older graphics cards.

Pixel lights

If you use pixel lighting, then each GameObject has to be rendered as many times as there are pixel lights that affect the object. If you combine two objects that are very far apart, it might increase the size of the object and now you have a lot of lights affecting this big object. If your objects were separate however, the light wouldn't have to be applied on the part of the mesh which is far away. This can result in rendering the combined mesh as many times as the uncombined mesh thus you didn't save anything. For this reason, you should keep GameObjects that are very far away as individual Meshes.

When rendering a mesh, Unity finds all lights surrounding the mesh. It then figures out what lights affect the mesh the most. The Edit->Render Settings are used to modify how many of the lights end up as pixel lights and how many as vertex lights.

Every light calculates its importance based on how far away it is from the mesh and how intense it is.

Some lights are more important than others depending on the game context. For this reason, every light has a Render Mode setting which can be set to Force Pixel or Force Vertex.

Imagine the player's car with head lights driving through the night. The head light is the most important light in the game. For this reason, the head lights Render Mode should be set to Force Pixel.

If you have a light that isn't very important and also visually doesn't gain much from being a pixel light, set the lights Render Mode to "Force Vertex". This way you don't waste rendering performance or lose any visual quality.

Per-layer cull distances

You might want to cull small objects earlier to reduce number of draw calls. For example, small rocks and debris could be made invisible at much smaller distance than large buildings. To do that, put small objects into a separate layer and setup per-layer cull distances using Camera.layerCullDistances script function.


Shadows are generally expensive. They can add a lot of performance overhead to your game if they are not used correctly. For more details about shadows, please read the Shadows page.

See Also