Search Unity

UnknownResourceProviderException loading Interface

Discussion in 'Addressables' started by Allan-Smith, Dec 2, 2018.

  1. Allan-Smith

    Allan-Smith

    Joined:
    Feb 7, 2012
    Posts:
    57
    Hello,

    I was using Addressables v0.1.2 on a project that was stopped for a while and decided to upgrade it to 0.4.8 yesterday. Had to reconfigure my addressables panel as I noticed it was all moved into scriptable objects, which is fine, however when I finished and tried out my game, I started getting a UnknownResourceProviderException when loading my UIs, which I reference using an Interface.

    I didnt understand what was going on and decided to, instead of loading my UIs from the interface they implement, I would load them with the generics as a GameObject (which they all are), and that worked. Is there a reason why now we cant do Addressables.LoadAsset<IInterface>(address)? My configuration is all fine since when I changed from IInterface to GameObject it worked as expected.

    Best,
    Allan
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    If I understand correctly, what didn't work was: LoadAsset<ComponentOnGameObject>(), but LoadAsset<GameObject>() did? (Which would require accessing the component afterwards from the loaded GameObject)

    Assuming that's right, there are some scenarios where this works today, and some where it does not. The scenarios where it does work are actually the bugs. Loading via component directly will never work when loading from a real-life asset bundle at runtime. Unfortunately it does work if you are running in FastMode in the editor (in play mode). On our list is to make this never work, to avoid confusion.
     
    Allan-Smith likes this.
  3. Allan-Smith

    Allan-Smith

    Joined:
    Feb 7, 2012
    Posts:
    57
    Oh... haha I see... yes that was the scenario, I have changed all my calls that were to components to be the game object and yeah been seeing more stable results (as before some were working some where not and I couldn't figure out the "rule" for it, therefore though it was a bug).

    Thanks for the confirmation though, while that would be useful to be honest its not really a big deal, after all the loading is most likely going to be used to then pre-populate a pool so the subsequent getcomponents are likely happening at loading time or sparse enough that aren't an issue... but its good to know!
     
  4. Deleted User

    Deleted User

    Guest

    I have a similar issue. I was (when using Asset Bundles) previously loading an asset with a get asset of type IMusicManager where IMusicManager was the interface to MusicManager which was a scriptable object.
    In fast mode, when using Addressables, this does not work. I can however use GetAsset<MusicManager> but it won't find it from its interface