Search Unity

Bug Performance Issues after Updating from Unity 2021.1 to 2021.3

Discussion in 'Localization Tools' started by Thut, Sep 2, 2022.

  1. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    After updating my 2021.1 project to 2021.3 (LTS) my localization addressables are taking 100x+ time longer to load when Addressables Play Mode Script is set to Use Asset Database.

    From the profiler I noticed the issue was stemming from LocalizedAssetBehaviour.OnEnable->Loading.ReadObject->Loading.ReadObjectThreaed->ReadObjectFromSerializedFile (took 765992 ms)

    When the Addressable Play Mode Script is set to "Use Existing Build" the performance is much the same as it was before updating Unity.

    I attempted to debug what was taking so long, but not sure If I got good results or not, my best guess would be some method in ContentBuildInterface like GetPlayerObjectIdentifiersInAsset or GetPlayerDependenciesForObject.

    Also, build times around Localization tables have increased significantly, specifically due to "Calculate Asset Dependency Data".

    Notable changes from update
    • Updated from Unity 2021.1.15f1 to Unity 2021.3.8f1
    • Updated from Localization Package 1.1.1 to 1.3.2
    • Updated from Addressables 1.19.15 to 1.19.19
    • Updated from Scriptable Build Pipeline 1.19.5 to 1.20.1
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300
  3. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    Thanks for the quick reply. I thought it might be an Addressables issue, the only reason I posted it here is because I was able to load a fairly complex scene through Addressables at the same speed as I had before updating. The only thing that has slowed down is specifically loading Localization Addressables when using the Use Asset Database play mode script for Addressables.

    I'll go ahead and submit a bug report as well. This issue is effectively preventing development of our game from continuing so I will likely have to revert to a previous version of Unity if I can't find a solution somewhat quickly.

    Is there any way I could revert the Addressables and Localization Packages back to the versions listed in my first post to see if that would fix it?
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300
    Yes you can change the manifest.json file in the Packages folder. Just change the versions in the JSON.
    Is this during playmode you have these issues?
     
  5. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    I've tried changing the manifest file, I'm not sure these very old versions are still available to download though. I also tried the "Add Package By Name" option in the package manager, feeding in a custom version. That worked for updating to a newer version of Addressables (1.20.5), but did not work for downgrading to a lower version. I even used the UI Toolkit Debugger to enable seeing all available versions of a package in the package manager. It seemed like only a few versions were still being hosted.

    Yes, the issue only occurs in play mode, and only when Addressables are set to "Use Asset Database" for the play mode script. If I run it with "Existing Builds" then play mode functions basically the same as it did before the update. I believe this is because the extra delay I'm experiencing in play mode has also been an issue with increasing build times. My build times have increased by roughly the same time that my editor stalls out for when entering play mode using the asset database play mode script. In the build process, the "Calculate Asset Dependency Data" for localization tables is now taking roughly 10 minutes.

    Thanks again.
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300
    The versions are still available. Changing the version in the manifest should trigger it to update to the older version.
    It won't work if there's another package that forces a newer version though. So you may need to downgrade a few packages.
     
  7. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    I was able to revert the Localization and Addressables packages to the versions I was using before the update, unfortunately the problem persisted. So I'm guessing the problem is in the editor/engine code.
     
  8. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    After a bit more digging, I found that simply clicking a StringTable Collection asset in the project window caused the same slow down as entering play mode. The busy message says Inspector.InitOrRebuild is causing the hang. The slow down is specifically from Loading.ReadObjectThreaded>ReadObjectFromSerializedFile. The slow down only occurs once per domain reload it seems. The slow down also appears to be exponentially worse for larger string table collections.
     
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300
    How big are the string tables? Do you have the table window open when doing this?
     
  10. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    The table window was not open when I was testing clicking on the string table collection asset files. Each collection contains 15 tables (one for each locale). The larger tables have 1000+ entries, somewhat uniquely, each entry has metadata associated with it per locale (for automated translation and syncing with google sheets). This was all working splendidly before the update though.

    I tested the Localization Tables window, seems like the exact same performance issues are there as well. Larger tables seem to take a disproportionate amount of time to load up (i.e. the load times don't seem to be linear to the number of entries or even the amount of text in said entries).

    I profiled the Localization Tables window and again the slow down is from ReadObjectFromSerializedFile.

    Clicking on individual String Table assets also has same ReadObjectFromSerializedFile performance issue.
     
    Last edited: Sep 4, 2022
  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300
    That's strange. Clicking on a collection should not load the tables, they are lazy loaded so will only be loaded when needed.
    The tables window performance was improved in 1.3.
    Can you post a profiler screenshot showing the breakdowns?
     
  12. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32


    This was taken from clicking on a small string table collection in the project window. Larger ones take several minutes to load.
     
  13. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    Here is the profiler when entering playmode (with Use Asset Database play mode script for Addressables)

     
  14. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300
    Can you please file a bug report with the project attached so we can take a closer look and see what's going on?
     
  15. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    I will try, the project is quite large so it might take all day. I might have to do it overnight. Would it be okay if I attach a .rar of the project folder instead of the folder itself to the report?
     
  16. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300
    Yes thats fine. If you delete the Library folder then it will help reduce the size. If its too large then you may not be able to attach it. Just write in the bug report that it was too large to attach and we can provide a link for you to upload it.
     
  17. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    Ran out of disk space trying to pack the bug report, going to go ahead and revert to a previous version of Unity. If you can give me the link I'll upload the .rar of the project.
     
    Last edited: Sep 6, 2022
  18. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    karl_jones likes this.
  19. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300