Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Addressables.LoadAssetsAsync<UnityEngine.Object> blocking other operation to be finish

Discussion in 'Addressables' started by Kultie, Apr 29, 2022.

  1. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    Hi, I'm having issue with API Addressables.LoadAssetsAsync. It seem to be blocking other LoadAssetAsync or InstantiateAsync operation until the LoadAssetsAsync finish.
    I'm using this API:
    Code (CSharp):
    1. var op = Addressables.LoadAssetsAsync<UnityEngine.Object>(Keys, result =>{...}, Addressables.MergeMode.Union, true);
    Any idea how to resolve this?
    I'm using addressable 1.18.15 with Unity 2020.3.11f1
     
  2. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    762
    Hey, just wanted to chime in. I think what you're running into is an engine side limitation. Typically we see this behavior with scenes since they require integration on the main thread (you can read a little about it here: https://docs.unity3d.com/ScriptReference/AsyncOperation-allowSceneActivation.html). I imagine something that you're trying to load requires main thread integration, which would also block the async operation queue.

    Unfortunately, that means I don't really have a good solution for how to resolve this. The thing I might recommend is to try and combine more of your keys into one load call, and as the assets are loaded you can cache references to them in a map. Then use that map to request assets after their initial load. I can't guarantee that'll work for you, since I don't know more about your project. It's kind of a shot in the dark. But, it might be something to consider and test out.

    Sorry I wasn't more helpful, but I hope that gives some clarification on what you're seeing at least
     
  3. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    Thanks, It's really helpful to know what might cause the limitation. There're some assets I need from addressable that are load with Awake callback (So as soon as the scene is loaded). I was able to reduce the blocking time significantly by combining multiple key into 1 load call like you suggest, the blocking still there but it tolerable.