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 Initialization improvement on low end devices.

Discussion in 'Localization Tools' started by Ultraspider, Jan 2, 2023.

  1. Ultraspider

    Ultraspider

    Joined:
    Apr 22, 2013
    Posts:
    19
    Hello, I'm using localization package v.1.3.2 and I'm facing long loading times on low end devices, more specifically on the Samsung Galaxy Tab A7 Lite.

    As soon as the first scene starts, a loading spinner is displayed until LocalizationSettings.InitializationOperation returns using the following code:
    Code (CSharp):
    1.     private IEnumerator Start()
    2.     {
    3.         Screen.sleepTimeout = SleepTimeout.NeverSleep;
    4.         yield return LocalizationSettings.InitializationOperation;
    5.        
    6.         #if UNITY_EDITOR
    7.         //delay to check how it looks in the editor, loads too fast otherwise
    8.         yield return new WaitForSeconds(1);
    9.         #endif
    10.        
    11.         titlePanel.HideLoader();
    12.     }
    When launching the app, it takes about 25 to 30 seconds to get passed the loader:
    ~ 10 seconds of black screen before it shows the loading spinner (I don't know if localization or addressable affect this)
    ~ 15-20 additional seconds before the loader is hidden. (sometimes even more if the tablet happens to be busy with background tasks)

    I have 3 tables: 1 string table with a little bit less that 300 entries, an audio assets table with ~175 entries and another audio assets table with 27 entries.

    Is there any way to reduce the loading time of the localization table?
    Maybe selectively choose which tables are loaded? Only the string table is needed to display the title screen, audio tables could be loaded later. I wasn't able to find the "preload" option for specific tables that is mentioned in other threads so I assume all my tables are preloaded for the default language when the application start.

    I would appreciate any advice.

    Regards.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,570
  3. Ultraspider

    Ultraspider

    Joined:
    Apr 22, 2013
    Posts:
    19
    Thank for you answering this fast.
    I don't know why but every tables were set to preload, I don't know if it's by default (the documentation does seems to imply it's not the case) or if I set that during my tests at some points in the past.

    Leaving only the string table for the default locale as preloaded solve the issue. The loading spinner is barely visible now. Selecting another language is also blazing fast now.

    However, as the preloading time was so long when loading the other string tables and audio assets tables as well, I was expecting the audio part to break and not being able to play correctly without additional code to make sure the audio was properly loaded before playing the first voice lines but that's not the case, everything is smooth and audio have no noticeable delay to play.
    So I'm a bit confused now o_O

    Is
    LocalizedAudioClip.LoadAsset()
    only loading the needed asset and thus is fast ?
    The documentation you pointed seems to indicate that when not preloaded, the table must be loaded, then the asset. That's why I was expecting the delay from the preload to bite me when playing my first sounds but everything is fine now.:)
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,570
    LoadAsset uses synchronous loading so it will be faster however it does block the main thread until loading is completed the first time and this can be a significant delay, especially if the asset bundles are remote. However it's working for you so no worries :)