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. Dismiss Notice

Remote Asset AsyncOperations Never Completing

Discussion in 'Addressables' started by etopian, Mar 5, 2020.

  1. etopian

    etopian

    Joined:
    Dec 11, 2018
    Posts:
    8
    Hey all,

    On our loading screen, we wait for a list of asset references to finish being instantiated (tracked via AsyncOperationHandle completions). This works great for all local assets, but the Completed callbacks never seem to be called after the asset bundles for any remote assets finish downloading. Restarting the game fixes the issue (presumably because all of the required assets are now available locally).

    Given that InstantiateAsync does successfully trigger the asset bundle download, I would expect the operation to complete. Is this not the correct workflow?
     
  2. etopian

    etopian

    Joined:
    Dec 11, 2018
    Posts:
    8
    Update!

    On our loading screen, we not only load all the required assets but also load the next scene. The pending scene is kept unactivated until all of the assets have reported they finished loading. Unfortunately, the AsyncOperationHandle's for remote resources do not fire off their completion events until the pending scene is activated, resulting in a deadlock as the two wait for each other.

    To better illustrate:
    1. Addressables.InstantiateAsync(localAddress); (Completes near instantly)
    2. Addressables.InstantiateAsync(remoteAddress); (Begins download)
    3. Load scene, waiting for both assets to instantiate before activating.
    4. Download completes, but the remote asset does not instantiate until scene activates.
    3-4 Deadlock

    Not sure if this is intended behavior or a bug, but I'll go around it by waiting for all assets to load into addressables before starting the process of loading the new scene.
     
  3. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    736
    Hey @etopian I've seen something like this before and while I can't remember the specifics, I can say that what you were seeing is expected behavior. It has to do with how setting allowSceneActivation to false is handled in the engine. Like you were seeing, if that scene wasn't allowed to activate then the other calls to instantiate get stuck.

    I'm glad you're able to setup something that works around this.