Tech-Art - General Optimization for Unity

From ETC Public Wiki
Jump to: navigation, search

Unity's Optimisation for VR Page:

A Talk about Building High Performance Daydream Apps:

In the comment it also includes an interesting article talking about Gear VR as a comparison, and also give you a general idea about developing for mobile VR:

Monitoring Performance: Daydream Hub:

Daydream Renderer in Unity (for higher quality rendering):

Some other things to keep in mind are the actual draw calls that are happening. Numbers say that 100 draw calls are the limit for for a nice, smooth experience (FPS wise). This means that with VR, this would drop to 50 (because you'd be rendering twice what is normal). So try to keep your draw calls below 50.

Tips to do this:

1. Reduce the number of materials in your scene. If an object can have one material and a texture that handles the different colors, (with maybe different details going into it handled by the shader itself - for instance bump maps and so on), do this. The more the distinct number of materials, the more the draw calls.

2. Use Static batching / dynamic batching to try and make the same materials be batched together.

3. Set objects to "Static" (check box on the top right in the inspector window) if they do not move. This makes it easier for Unity to handle the rendering.

4. Use the Frame Debugger in Unity (Window > Frame Debugger) to see how many Set Pass Calls you're incurring in a frame. This is equivalent to draw calls. Try and see if objects with the same materials are not being batched together, and try to see why that's happening and make sure it batches together. A reason why that's happening could be the fact that you're getting the material of each of those objects in your scripts. This makes a new instance each time. Don't do it. Try using GetComponent<Renderer>().sharedMaterial instead.

5. Keep an eye out for the set pass calls and the batches / saved by batching numbers in your stats window. If the numbers don't seem right based on whatever was outlined above, something is wrong.