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

Fixes in EditorHosted and PackedPlayMode

Discussion in 'Addressables' started by Kamand0l, Jul 28, 2021.

  1. Kamand0l

    Kamand0l

    Joined:
    May 19, 2014
    Posts:
    24
    Hi !

    I recently needed to develop and test locally using the Addressables Hosting feature along with Use Existing Build for Play Mode Script. I believe this setup is meant to closely mimic a device build downloading content from a CDN and as such I found a couple of issues:

    1. The Editor Hosting service is actually hosting every Addressables Group's BuildPath. Yes, even the local ones pointing to the RuntimePath.
    Although the catalog would not normally load those addressables from the hosting service URL, it's pretty misleading to have them hosted. If for some reason/bug they get loaded from the hosting service it would be very confusing seeing how things works in the Editor but not in the device.

    hacky fix:
    https://gist.github.com/sp-ricard-valverde/5a47d55dfae2af723b5155551fa2c77a

    2. When loading a scene(Addressables.LoadSceneAsync), if the scene is bundled but the asset bundle or dependencies fail to load(in my test I deliberately removed the asset bundle containing the scene from the hosted path) the scene will still be loaded using UnityEditor.SceneManagement.EditorSceneManager.LoadSceneAsyncInPlayMode as fallback. When using Build for Play Mode Script it should fail to load, same as other asset types.

    hacky fix:
    https://gist.github.com/sp-ricard-valverde/13079273fde6d26094b4eff13ebbb2d3

    Cache is being cleared every run, ran through the debugger to find the issues.
     
  2. Kamand0l

    Kamand0l

    Joined:
    May 19, 2014
    Posts:
    24
    Anyone ?
    # 2 is particularly critical for setting up a reliable local development environment