Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Question Analyze and optimize Oculus Quest app launch time

Discussion in 'VR' started by Wattosan, Aug 12, 2021.

  1. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    450
    Hello,

    I'm interested in analysing what exactly is loaded into memory once I launch my app on the Oculus Quest device.

    For example, we are using the new Oculus instant runtime-driven splash screen. This screen is active for less than a second. Then there is 4-5 seconds darkness (black screen). Then the Unity splash screen is activated (this stays up for 2 seconds) and then finally the first scene is loaded. My end goal is to reduce the 4-5 seconds darkness.

    I've already optimized the biggest textures and audio clips. There are no preloaded shaders. I am wondering what else can you suggest and how could I see what is exactly going on between that time frame, i.e which assets are being loaded, if at all?

    Thanks
     
  2. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    450
    I did a little bit of profiling by attaching the Unity profiler on the start of the Quest app. On the image what you see happens during the splash screen. There is very little that is loaded into memory. At the very end of the graph you see what happens after splash screen, that's where all the assets are starting to get loaded into memory. So this made me realize that assets probably do not cause the long load time before the Unity splash screen.

    Profiler slice of Unity splash

    How can I profile what happens before the Unity splash screen?
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,833
    i'd remove unity splash screen, and add own scene 0 for splash (if its needed),
    then from your own simple splash screen (which is really light and fast to load),
    you can load main scene additively (while splash screen is playing).
     
    DevDunk likes this.
  4. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    450
    Once the splash screen is loaded, the loading times are okay. It's what happens before the Unity splash screen. 4-5 seconds of darkness and only then the splash screen is loaded. I'd like to think it's not the splash screen that takes that much time to load.
     
  5. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    450
  6. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,098
    There shouldn't be a big gap there with Auto-Connect Profiler or -profiler-enabled option, as the profiler starts up quite early. This can be combined with deep profiling support and -deepprofiling and can benefit from an additional -profiler-maxusedmemory 67108864 (64MB, default 16MB) to avoid a bigger frame to be dropped instead of transmitted
    https://docs.unity3d.com/Manual/ProfilerWindow.html#command-line
     
  7. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    450
    The issue with deep profiling is that if I enable its support for the build, the game crashes a few seconds after launch. So I cannot seem to be able to test it with Unity version I am using (2019.4.26f1).
    Also the Auto-Connect profiler itself is very unreliable, as mostly it doesn't seem to work. The way I test is that I launch the game in Quest, then wait a second or two (the Unity profiler has become unusable for a short duration of time, after which the device is available in the devices to profile) and then manually connect the profiler.

    Even if I do get it working, should it report any data in the profiler already before the Unity splash screen?
     
  8. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,098
    We've been stabilizing Profiler Connection, ADB and Auto-Connect but most of this has only landed in 2021.2 and is too risky to backport to LTS.

    Things you can try is to turn off mobile data on phones, have only one Editor running on the machine that build the player and maybe have the editor and player run in their own wifi to isolate it.

    You can however also use the command line (ADB) to start the player with profiling enabled and dump the data for a set amount of frames to a .raw file, then extract that file and load it into the Profiler. That should also get you profiler data for earlier moments in the startup of the app. The command line arguments for that are also listed in the list I linked to above.
     
  9. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,098
    When starting with -profiler-enabled (or Auto-Connect) it starts gathering profiler as early as possible from the perspective of Unity's Native startup code.

    Note however that Auto-Connect itself introduces a waiting moment to the startup process with a timeout of 10s to try and find a listening editor, so you might be seeing that as slowing down the startup