Search Unity

Profile Loading Times

Discussion in 'Editor & General Support' started by ImpossibleRobert, Jun 24, 2014.

  1. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    527
    The profiler inside Unity gives quite some great insights. Unfortunately it starts to tick only when the scene is loaded. What I would really need to profile is the loading time of the scene itself though. My game start takes around 10-20s which is way too long, scene switching again ~10s on a S4.

    How can I find out what the biggest bottlenecks are to speed up scene loading times? Is there any tool (Unity or Asset Store) which can find that out for me? I really don't want to spend hours guessing and trying out all kinds of things that only might be critical.

    Would be awesome if someone had advice on this for me!
     
  2. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    There's no tool that will let you profile the loading times. If 10s is way too long, then load a smaller first scene which can load more quickly. If you get that first scene up and running, you can then call Application.LoadLevelAdditiveAsync() to load more data into the scene.
     
  3. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Forgive the shameless plug, but you might want to check out SECTR STREAM. This doesn't measure your load times but it gives you tools to break up a scene into chunks and stream those chunks in and out. If your scene is amenable to that, it can make fur a huge reduction in load times.
     
  4. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Forgiven. :) Your post seemed exactly what the OP wanted to hear.
     
  5. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    527
    I played around with loading things additively but it is only possible for certain scene types. I would really like to increase the startup time of the app until I reach the main menu scene.

    As there seems to be no tool (would be a great feature!), what general advice could you provide? What takes a long time to load on an Android S4 and what is not an issue? Are there any rules? I'd suspect that the Unity developers know very well what are the expensive operations but there is no documentation or help on this topic. E.g. Is it important to combine multiple textures into one or does that make no significant difference. Does using substances make a big difference and what influence do the cache settings for them have? Or should I even precalculate them in case loading the substance engine in itself already adds significant loading time penalties? Does the format of the music influence loading times (mp3 vs ogg...) etc.
     
    andrew-fray likes this.
  6. DonKanallie

    DonKanallie

    Joined:
    Jul 17, 2013
    Posts:
    10
    I would also like to hear about that from some Unity devs.
    This is a really important topic, and "Just slam a long loading screen in your game" isn't really a sufficient answer.

    +1 For a loading time profiler
     
  7. kobyle

    kobyle

    Joined:
    Feb 23, 2015
    Posts:
    92
    Still no help on that matter? I have issues with this as well.

    Koby
     
  8. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Ping! A game I'm working on for a client takes 20 seconds to get from the menu scene to the game scene. The game scene is large, but not outrageous — maybe 100 scene objects or so, most of it UI (the sprites that are the actual game get created on the fly after the scene starts).

    I wish there were a profliing tool that would let me see how that 20 seconds was spent, so I'd have some idea where to start optimizing.
     
  9. 8bitRick

    8bitRick

    Joined:
    Nov 18, 2013
    Posts:
    11
    Bump! ... it's been a year since last post but Google lead me here. So, any tips? I'm still googling around finding chunks of advice on things but nothing complete.
     
  10. djarcas

    djarcas

    Joined:
    Nov 15, 2012
    Posts:
    246
    Ok, but there really SHOULD BE.
     
    Tx and alphadogware like this.
  11. io-games

    io-games

    Joined:
    Jun 2, 2016
    Posts:
    104
    Bump, we are still wating
     
    Tx likes this.
  12. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,451
    Since 2018.2 you can either build the game with the Autoconnect Profiler build option or start it via command line with -profileStartup (same effect as Autoconnect Profiler) to achieve this. You might want to also set
    -profiler-maxusedmemory 8388608
    (size expressed in bytes, 64 MB instead of the default 16 for players and 256 for Editor. Available since 2018.3) so that the profiler memory buffer doesn't run out of space while transmitting that amount of samples within one frame.
     
  13. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,451
    Note to people stumbling across this thread now, In Unity 2019.3
    -profileStartup

    was renamed to
    -profiler-enable

    and we also added:
    -profiler-log-file <Path/To/Log/File.raw>

    and
    -profiler-capture-frame-count <NumberOfFrames>

    Please consult the bottom of this page for version specific, up to date info on the command line options.
     
    jiexiangshen, dani-ria, M_R_M and 4 others like this.