Search Unity

Optimization tips!

Discussion in 'Editor & General Support' started by Rachan, Dec 20, 2021.

  1. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    776
    Hi there!

    I really want to know the best way to optimization game for mobile
    anyone have a tip or trick about this?

    My game just a 2D game but I need to optimize it more.
    I know that Unity have a Profiler but I don’t know how to use it, if I run a game on mobile the performance should be different than in Editor right?

    Thanks!!!
     
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,451
    If you're looking for general optimization advice for mobile, this free e-book we published on that exact topic is probably a good place to start.

    General advice is only going to get you that far though. There's an infinite amount of possible projects and setups that all come with their own performance considerations so, ultimatively you'll have to get more comfortable with the Profiler and other analysis tools, regularly review your projects performance and yes, doing so on your target device, ideally something close to your minimum spec devices. (Because, yes, the performance in the Editor can generally not be compared to that on a device)
     
    Kurt-Dekker likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,688
    Like everything in Unity there are tutorials, and the more you use the profiler, the more you will get out of it.

    At a minimum you want to understand what performance issues you are having:

    - running too slow?
    - loading too slow?
    - using too much runtime memory?
    - final bundle too large?
    - something else?

    If you are unable to engage the profiler, then your next solution is gross guessing changes, such as "replace all textures with tiny textures" or "replace specific giant objects with cubes" to try and figure out what is bogging you down.

    Each experiment you do may give you intel about what is causing the issue, and more importantly let you eliminate candidates for optimization. For instance if you swap out your biggest textures with 32x32 stamps and you STILL have a problem, you may be able to eliminate textures as an issue and move onto something else.

    This sort of speculative optimization assumes you're properly using source control so it takes one click to revert to the way your project was before if there is no improvement, while carefully making notes about what you have tried.