I'm sorry your web browser is not supported we strongly recommend you use Microsoft Internet Explorer 10 or higher or an alternative browser.

Mobile Optimisation in Unity



Home

Mobile Optimisation in Unity

I have been on a never ending quest to optimise my mobile game and I have come across these fixes that may be able to help you out. (May be game specific but this helped me)

  • On Image and Text components that aren’t interacted with you can uncheck “Raycast Target” on it, as it will remove them from any Raycast calculus.
  • Click on your textures in your “Project” window. Click on the “Advanced” arrow, and now check “Generate Mip Maps”, Unity especially recommends it for faster texture loading time and a lower rendering time.
  • Set the “Shadow Cascades” to “No Cascades” (Quality settings). A higher number of cascades gives better quality but at the expense of processing overhead.
  • If you have dynamic UI elements like a Scroll Rect with a lot of elements to visualize, a good practice is to turn off the pixel perfect check box on the canvas that contains the list and disable the items that aren’t visible on the screen.
  • Set all non moving objects to "Static"
  • Above Unity3d 2017.2 you should turn off "autoSyncTransforms" on the Physics tab
  • Always use Crunch Compression Low on textures
  • Try to keep the “Collision Detection Mode” on “Discrete” if possible, as “Dynamic” demands more performance.
  • You can go to the TimeManager window (Edit > Project Settings > Time), and tweak the “Fixed Timestep” value. This value represents the duration between two calls of the FixedUpdate() method.
  • You can use Coroutines to call a method only every second for example, using the instruction: “yield return new WaitForSeconds (1);” It could be used to refresh some UI display:
  • Set particles culling to "Pause and Catch Up"
  • Use ShaderVariantCollection.WarmUp to fully load shaders before gameplay
  • Baked your shadows or turn them off
  • Out of Built-in Shaders, they come roughly in this order of increasing complexity:
  • In a mesh renderer, turn contribute to global illumination off and if possible turn of cast shadows if it doesn't effect gameplay or graphics.
  • If you have to use shadows use "Shadowmask as the Shadowmask mode in the quality settings. Static GameObjects that cast shadows always cast baked shadows.
  • Set LOD Bias in quality setttings to 0. When it is set between 0 and 1 it favors less detail.

Unlit. This is just a texture, not affected by any lighting.
VertexLit.
Diffuse.
Normal mapped. This is a bit more expensive than Diffuse: it adds one more texture (normal map), and a couple of shader instructions.
Specular. This adds specular highlight calculation.

I am not a professional and these tips are pulled from all the research I have done. Some people might crucify me for the above but this is what I have heard.

Particles, Lights, Shadows and Textures are the main culprits of lag (from my experience and if done incorrectly). But ultimately using the profiler will help the most in reducing bottlenecks.