Search Unity

Addressables doesn't work in windows standalone

Discussion in 'Addressables' started by mr-gmg, Apr 6, 2020.

  1. mr-gmg

    mr-gmg

    Joined:
    Aug 31, 2015
    Posts:
    62
    Hello guys, I started working with addressables and everything was fine until I decided to build a standalone build. It simply did not work there. My further investigation tells me that OnCompleted callback never happens.
    Screenshot_17.png
    Code (CSharp):
    1. private void Start() {
    2.       Addressables.LoadAsset<Sprite>("resource_wood").Completed += OnCompleted;
    3. }
    4.  
    5. private void OnCompleted(AsyncOperationHandle<Sprite> obj) {
    6.      m_image.sprite = obj.Result;
    7. }
    I think I missed something, but I've tried everything that I could. As I said it works perfectly in unity editor but doesn't work in standalone.

    unity 2019.3.7f1
    addressables 1.1.10

    Any idea what I did wrong?
     
  2. RogueCode

    RogueCode

    Joined:
    Apr 3, 2013
    Posts:
    230
    Have you done the build content thing in the addressable window? The button at the top right.
     
  3. mr-gmg

    mr-gmg

    Joined:
    Aug 31, 2015
    Posts:
    62
    Screenshot_18.png
    yes I did it and tried it with all modes
    Screenshot_19.png
     
  4. RogueCode

    RogueCode

    Joined:
    Apr 3, 2013
    Posts:
    230
    Any reason to not update? You're on a pretty old version, maybe it'll magically fix it?
     
    mr-gmg likes this.
  5. mr-gmg

    mr-gmg

    Joined:
    Aug 31, 2015
    Posts:
    62
    It was the version that package manager shows by default, and was not the upgrade button, I updated to the last 1.7.5 version, but the problem still was there.
    Finally, I realized what was the problem, I used Addressables probably not how it supposed to be. If you load content in standalone build in
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
    private static void Init() {
    Code (CSharp):
    1. [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
    2. private static void Init() {
    3. }
    addressables just silently dies, no callbacks, no exceptions, etc. I know it was weird to use it like that, but still, it would be nice to get some feedback from addressables in such a case.
     
    RogueCode likes this.