Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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:
    460
    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:
    460
    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:
    9,566
    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:
    460
    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:
    460
  6. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,517
    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:
    460
    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,517
    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,517
    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
     
  10. jamie_xr

    jamie_xr

    Joined:
    Feb 28, 2020
    Posts:
    68
    Hi @MartinTilo

    I know this is an old thread but I've ran my game with these arguments and no idea where the raw file is on android - I tried the persistent data path, and the root of the storage, but no luck, do I need to put

    My command line:

    Code (CSharp):
    1. adb.exe shell am start -n com.company.game/com.unity3d.player.UnityPlayerActivity -e -profiler-enable -profiler-capture-frame-count 5 -profiler-log-file profile-capture.raw