Performance considerations - mobile games - (Unity 5) - for noobs

edited in General
These notes revolve mainly around mobile games - as I needed to get the best feel and performance out of my current game.

Here are some things that I have learnt along the way - that might help some one who is going though the same thing.

In general, real-time lights are a little expensive for mobile devices and you want to avoid them where possible, especially is you want to use the standard Unity shader. (I use just one real-time light - as a real time torch)

Also real-time shadows are out of the question - thus the need to bake them in - this should give your game some much needed lighting realism. Baking your lights in - will also allow you to throw in a ton of "extra" lights at very little run-time compute.

1) For the objects you want to bake. (normally the game objects that will not move in your scene)
a) Make sure you "generate lightmap UV's" for these models - without those you are going nowhere.
b) Make sure you have set all these items to static inside your scene.

2) Try only bake your larger game object objects - leave the smaller ones for light probes.
a) Light probes are also well suited for moving (dynamic) objects in your scene. (Light probes - produce lighting that is quite cheap to compute.)
b) Leaving the smaller items for light probes will also reduce you bake time.

3) When creating light probes: make sure to get this free store asset: https://www.assetstore.unity3d.com/en/#!/content/58290
a) Its going to save you a ton of time setting up light probe regions/volumes.
b) Make sure you check the demo scene :)
c) You will need to place a "master" volume over all you other smaller volumes - this should stop any light "bleed".

More on Unity light probes here: https://docs.unity3d.com/Manual/LightProbes.html. Light probes are going to allow your non-static objects to receive your baked-in static light projections.

4) When starting you first bake:
a) To speed up baking - make sure to reduce you "baked resolution" - to something very small. (like 1)
b) Then do increments on 1's until you are happy with the final result - I left mine on 10 - it was good enough for me.
c) Make sure you have "Add direct light" checked - for light probes.

5) Naturally: Make sure all your game lights baking setting are set to "bake".

Other than that - some other useful tips:

1) Make sure your models are using a shared texture - this is going to boost your static batching performance.
2) Make sure to use a forward rendering path.
3) Make use of occlusion culling
a) if you have a scroller type game - make sure you dont use over sized meshes - smaller ones work better here.
Thanked by 2roguecode Oneil_CT
Sign In or Register to comment.