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 have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Resources.Load() blocks main thread for as long any Async Operations are in progress

Discussion in 'Android' started by livingtarget, Feb 23, 2023.

  1. livingtarget

    livingtarget

    Joined:
    Apr 21, 2015
    Posts:
    57
    Hi,

    We are using Unity 2021.3.19f1 and recently upgraded from Unity 2020. We noticed this massive performance regression when loading our main scene async and other async operations were also blocking the main thread.

    After a few days debugging we noticed that it would happen any time Resources.Load() was being called while any Resources.LoadAsync() or SceneManager.LoadSceneAsync() were in progress for the whole duration of the async operation(s). The only way to stop it blocking the main thread was to change every Resources.Load() call to Resources.LoadAsync() and then it would be "fine" as in the burning room dog meme.

    I've attached a screenshot as an example. Here I'm trying to do an async scene load (30 seconds on Android) and the third party Facebook SDK calls Resources.Load() to load the settings and voila main thread got blocked for 30 seconds.
    unity2021bug.png

    I doubt this is an intentional change and is indeed a bug. We also did not experience this on PC or iOS so I assume it is maybe just an Android bug.
     
  2. livingtarget

    livingtarget

    Joined:
    Apr 21, 2015
    Posts:
    57
    DungDajHjep and densy07 like this.