Search Unity

How to make a downloaded file in runtime as addressable via code

Discussion in 'Addressables' started by Halen1999, Sep 10, 2019.

  1. Halen1999

    Halen1999

    Joined:
    Sep 10, 2019
    Posts:
    3
    Hi, I have an app that need to download a file from Firebase when it runs and I want to make that file addressable via code. I've made a prototype in PC and tried this tool https://github.com/favoyang/unity-addressable-importer but I receive this error

    upload_2019-9-10_10-44-48.png
    My Addressable Import Setting
    upload_2019-9-10_10-41-53.png

    And this is my code to load it
    upload_2019-9-10_10-43-59.png



    I dont know what should I do to fix it. I tried to read the document but it's so confusing :( Thanks for reading.
     
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    268
    I'm afraid you probably need a tutorial for basic concept, like this one https://forum.unity.com/threads/demo-tutorial-for-remote-hosting-using-amazon-s3.724022/

    Thanks for trying the importer, but you won't need it at the moment. It's for automation asset importing, eg. when you have hundreds of them. Simply remove the package and focus on the basic is better.

    For firebase hosting, it could be a little bit tricky because of lacking the http protocol, this may help https://forum.unity.com/threads/how-to-load-addressables-from-firebase-storage.739964/
     
    Halen1999 likes this.
  3. Halen1999

    Halen1999

    Joined:
    Sep 10, 2019
    Posts:
    3
    Hi, thanks for the reply, I've watched this video and I'm still not get it. In my case, I want to make an asset as addressable asset, but that asset is not in the project when I build, it appears when I run the app only. The video you showed me seems like not matching my case. :(
     
  4. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    268
    My misunderstanding then. So what you want is to use addressables API to load an asset (bundle) not generated by the system? That will be much harder. You need prepare a catalog, and write a custom asset provider (check out BundledAssetProvider). That make sense if you intend to load asset bundles not build by the system. However in your example, why not just read the text file directly?
     
    Halen1999 likes this.
  5. Halen1999

    Halen1999

    Joined:
    Sep 10, 2019
    Posts:
    3
    The text file is just my testing :D In my actual game I want to use the Addressable Assets to make the DLCs system. So is there any way to do this with Addressable Assets? I'm using AssetsBundle but I found the new one easier so I want to make a switch.
     
  6. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    268
    That probably a broad topic. Unless you have specific requirements, DLC is a trivial case for the system. eg. simply make each of your DLC a group (which turns into a bundle).