Optimization Techniques?

So, I've got less than 5 lights, a terrain, 3 animated models with less than 3000 tris a mesh, a few low poly buildings, and a skybox.

Why is this stuttering really badly in the Web Player? We're in Firefox 3.5 on a Macbook Pro. Anyone know of anything I could be doing terribly wrong?

I've watched the Optimization video from Unite 2007, but I feel that might be a bit out dated.


First, how many bones in your animated models? (in case you have a crazy number!)

Second, there are a number of settings in the Terrain engine which can affect performance. To improve performance you can:

  • Increase the pixel error. This results in more significant height-popping of terrain subsections.
  • Increase the detail distance (the distance that grass and detail meshes are visible)
  • Decrease the tree distance (the distance beyond which trees aren't drawn at all)
  • Decrease the billboard start (the distance at which tree meshes are replaced with billboards)
  • Reduce the Max Mesh Trees (the maximum number of trees which are displayed as meshes at any one time - any others will be displayed as billboards regardless of their proximity)

A screenshot or more detailed description of what your terrain is like might help solve the problem. Eg, how many splatmaps / grass textures / detail meshes etc are you using? How densely distributed are your trees?

There's a chance the above settings could solve your problem, if you have previously adjusted all these settings for maximum visual effect, and you have a lot of detailed tree meshes.

I also notice that you haven't mentioned any scripting in your post - are you using any custom written scripts, or just using built-in scripts from Unity's standard assets?

Use the profiling tool to see what is causing the lag then optimize there first, repeat until done.

I have found using Coroutines and threading where possible really helps reduce the framerate drop I get when I put in a new cpu or resource heavy framework. The Unity team is pushing their new ECS system that is supposed to help give major performance boosts too.