Optimising a game

What is game optimisation generally based on?

  1. Computer hardware - Is it possible to detect hardware on the target system to allow the game to choose between low poly and high poly models?

  2. Framerate? If the framerate drops below a certain level, use low poly models or remove post effects.

  3. Something else that I can’t think of…

I don’t know if #1 is possible in Unity, beyond the shaders themselves that scale back if the hardware can’t use them.

#2 could be quite possible. But in actual usage it could cause problems, for example the framerate drops below 20fps so some models switch to lower ones, the framerate then increases and they switch back, then back again etc. You’d probably need to average the fps counter and maybe create a three strikes kind of system, where if it drops below X fps more than three times in the space of a few minutes, then switch to lower quality models. Though it’s a lot of fiddling about and a simple options menu at the start would be better I think.

#3 Make lots of use of Occlusion culling, lightmaps over realtime, fake as many things as you can rather than use the realtime variety, avoid using too many different materials at once, use lower res textures, and wherever possible split up your levels and have them load new sections in additively while unloading (destroying) old sections.

There’s a page or two on the site which covers ways to optimize your game and gives a few useful tips.

  1. Yes, there is a class that offers info like GPU name
  2. sure but its a bit tricky to do this mid game. you would want to run a benchmarking scene or have 3d main menu which you use for benchmarking

In my opinion;

The best optimization is to make sure that the game runs smooth whatever the hardware. Pumping graphics up should be an extra…

Considering those options you named should be when you are SURE you can’t optimize more the game and you need to cut off / adjust what you created.

Consider occlusion culling, lightmapping, better/lower res textures, combined meshes, more optimized scripting … etc. If all of these are used properly and your target hardware (mobile? low/high end desktop/laptop? …etc) is well defined then you shouldn’t reduce the quality of your game until it is absolutely required.

The in-game settings in unity should do the trick in most cases too.

Look at the different bottle necks which are mostly Graphical (draw calls/texture memory/# poly) and CPU (mostly your scripts).

The profiler in the Pro version is great for that. Also check out the guide in the official documentation about optimization in Unity.