Search Unity

Addressable is so confusing :(

Discussion in 'Addressables' started by mekartikshah, Jul 29, 2019.

  1. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    53
    Hey everyone,

    I am so confused between addressable and AssetBundle, I am pretty much used with AssetBundle but not with Addressable.

    After watching videos of Unite I feel that I should go with addressable instead of AssetBundle.

    Below are some decision-making steps and why I choose to go with Addressable.

    1. I have developed a custom educational application to help the student in learning and that app has different topics and subjects as per students need, so what I had created a separate scene for a separate topic so they can download the content as per their need and helps me reduce the size of the application.

    2. to achieve above-mentioned point at first I planned to go with AssetBundle, I used it before in 2017.4.0f1 version, but for this application, I am using 2018, so I tried researching and I found out that addressable is the new way for managing and handling assets (I tried watching videos and understanding a bit and I think it is powerful tool and I can use that instead of going with Assetbunlde).

    3. last thing I feel is unity going to deprecate the Asset Bundle, so I think it's better if I move on with Addressable.

    Below are problems I am facing in moving on with Addressable

    1. I feel that package manager documentation is not that clear.

    2. I am hosting my Unity Scene and supporting assets to Azure Blob, I am not able to find how to upload my scene and assets to azure, what I understand is that I can use my custom IHostingService but documentation of IHostingService is not clear (or I am not able to understand), so I have no idea on how I can go forward with IHostingService.

    P.S. - I Maybe misunderstand hosting, in that case, please guide me on how I can upload my scene and folders to azure.

    3. I haven't tried downloading addressable from the server because I am not able to upload it.

    Guidance or help is highly appreciatable.
     
  2. MoctezumaDev

    MoctezumaDev

    Joined:
    Aug 14, 2013
    Posts:
    44
    Addressables is not the same as Asset Bundles. Addressables should help in the process of building and using your Asset Bundles. One of the very early problems with Unity was that everything that was referenced in a Field of a GameObject would be packed with your player, there is also the possibility of loading your stuff either from Resources or StreamingAssets. The idea behind Addressables should be that you could easily identify what should be packed in your player and what should be sent to be build and served as an Asset Bundle. In other words before you could only have "hard" references to a prefab in your GameObjects and with something like AssetReferences they would allow you to have a "soft" one which meant the asset could be used in the editor, be served locally or remotely base in the type of build you created (development, production, etc...).

    I totally agree the current workflow is very confusing and in my humble opinion they over complicated the solution. They seem to be going away from their legacy workflow but the new one doesn't feel better and it even breaks some interesting functionalities like the asset bundle browser that they released not long ago.
     
  3. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    126
    Yes, Addressables is the most confusing, hard to understand, needlessly complicated, and worst documented AND bug ridden part of Unity that I have worked with. (Sorry to devs, but it is true.)

    If it is to be so complicated then they could at least provide some really detailed documentation. Instead it feels you have to somehow be able to read their minds in order to understand how to use it.

    Eg. I don't even know where the Asset Bundles are built to and if I were to deploy to production, which files would I need to upload to where. Just basic stuff and there is nothing in the documents that tell. (Maybe the Hosting Services? But that seems just to be for development? Nothing is clear.)
     
    aka3eka, EricMay, DhiaSendi and 5 others like this.
  4. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    53

    As a matter of fact, i am aware of all the things you have mentioned in your post and i feel the same, but from my perspective - i don't think it's very complicated but what i strongly feel is the documentation and examples are not good. and there are no third party tutorial which can help us, my suggestion is let's not discuss on the problem and find out the solution of the problem together, what say?

    Can any one have any idea of how i can host my assets on custom server (ex. - i am using azure blob storage for storing and yes i know about IHostingService but that is not documented well :(, if anyone have any examples for IHostingService then it is appreciable.

    Please forward this question to some one from unity who is in addressable team.
     
  5. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    53
    @unity_bill can you please take a look at this thread, i am facing problem in understanding of IHostingService from my end can you provide any example of IHostingService?
     
  6. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    529
    IHostingService is for creating a hosting service inside the editor while developing.
    for production, you upload your bundles wherever you want and addressables will download them using standard HTTP

    if you want alternative methods, you need to change the AssetBundleProvider to your custom implementation
     
    mekartikshah likes this.
  7. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    126
    I think the documentation needs some new writers. Someone with a fresh set of eyes needs to come in maybe do a complete rewrite of it as it isn't written in a way that is easy to follow at all.
     
    JDaze, EricMay and phobos2077 like this.
  8. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    126
    Thanks for confirmation. So there is nothing in the documentation that guides how one would actually go live with a game that uses Addressables!
     
    Oshigawa, phobos2077 and mekartikshah like this.
  9. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    53
    This is something i am missing, now i got what IHostingService is for, i really appreciate this help. Now a basic question like asset bundle where can i find addressable in Asset folder, so i can upload it in my custom server?
     
    chanon81 likes this.
  10. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    53
    and in Unite talk they recommend us that if your deployment is after summer 2019, then you should go with Addressable but they forget to told how :p
     
    phobos2077 and MoctezumaDev like this.
  11. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    126
    Exactly!

    Also, where to configure url to custom server?
    And what happens when content update? Which files are changed? Where to upload them?
    Is content update the same thing as releasing app update?
    Must old asset bundle versions built with previous version of the game that have been released be kept forever? (ie. if you lose them you will be screwed?)
    What if I already released the game and completely clear the addressable data folder and release an update?
    How would I manage all the versions of the asset bundles? (Or is only the latest one important?)
    How exactly do you specify which asset bundles will be included with the game?
    What happens if I remove an asset that I no longer need from the build. Will it affect players on previous versions?
    Is it possible to specify different servers for different asset bundles?
    What about this content catalog or bin file? How does that exactly work?

    There are so many details/questions that one would have to understand to actually release a live game using it, and the documentation doesn't even explain the basics. How could Unity expect devs to use it? Do you think we have mind reading ability?

    And NO do not point to hour long talks.

    As others have noted UI/UX is very bad. If it was clearer then it could guide user with less need for better documentation. Instead UI/UX is practically undecipherable. Again requiring mindreading abilities to understand what it is meant for.

    If any of
    - Easy to use UI/UX
    - Easy to use API
    - Good, Detailed Documentation
    - Designed to be Simple to Grasp
    - Not Needlessly Complex
    - Optimized to be Easy to Use for most common Use Cases
    - Bug Free
    were true, then it would begin to be usable.

    And, most common use case is people want to have Asset Bundles on their server somewhere and let the game download them when needed. [Yet no documentation explaining what files needed to be uploaded, how to configure it. The UI/UX is too confusing instead of easily guiding user to this common task.]

    Most commonly, they want to download the asset bundles on a loading screen - NOT while the game is playing and THEN during the game playing would probably prefer simple Sync loading of resources like how Resources.Load works and if asset not available then just use error placeholder and log error. [Yet Addressable API forces everything to be async.]

    Async part is ok to have / provides flexibility .. but most of the time is just needless complexity. Zero gain - rather negative gain as due to needless complexity in Addressables, it results in your game code inheriting the needless complexity.
     
    Last edited: Jul 29, 2019
    henkjan, phobos2077, Bedtime and 2 others like this.
  12. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    361
    The easy way is that make each downloadable scene addressable (scene level addressable). Then change the group's packing mode to PackSeparately results in a bundle per (top-level) entry (in your case a bundle per scene).

    No need. Azure Blob can be accessed from http protocol. To enable it, please follow posts below,
    https://docs.microsoft.com/en-us/azure/storage/blobs/storage-manage-access-to-resources
    https://stackoverflow.com/questions/11825927/accessing-windows-azure-blob-storage

    Then follow this guide, change the RemoteLoadPath to your Blob folder, and port to 80.
    https://docs.unity3d.com/Packages/c.../manual/AddressableAssetsHostingServices.html

    After build asset, the bundles can be found in Library/com.unity.addressables/StreamingAssetsCopy/aa/[PLATFORM], copy the folder with file catalog.json to to your server.
     
  13. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    361
    This is actually a good advice. The documentation need to be a guide, instead of reference.
     
  14. MoctezumaDev

    MoctezumaDev

    Joined:
    Aug 14, 2013
    Posts:
    44
    Well in the Unite LA talk they explain a lot of the latest stuff, that is not explained in the documentation or in the examples. They even explain why they made some of the featues this complicated... "they are trying to remove hidden magic" :')



    The video explains a lot of the stuff I was trying to figure out at the beggining.
    Bill also explains some of the roadmap and weather you should use Addressables or not.
     
  15. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    53
    @Favo-Yang I must say THANK YOU! the solution you provided helps me understand the addressable better, below are the steps I followed as per your suggestion,


    I have three asset bundles
    1. Scene : (with .scene extension)
    2. Scene lighting data : (this is a folder and contains all the lighting data of the scene)
    3. Scene data : (this is a folder and contains all the prefabs, scripts, models, important plugins (if any))

    so what I had done is create something like this :
    Screenshot 2019-07-30 at 19.36.50.png
    and then create a new Inspect profile with the below data
    Screenshot 2019-07-30 at 19.37.58.png
    and I change my group setting to
    Screenshot 2019-07-30 at 19.56.37.png
    and then I click on build and I found the folder as you suggested in the previous reply, I had uploaded the folder and catalog.json to server.

    NOW upload is done.

    NOW it's time to load the scene from the cloud and I am having confusion here.

    I wrote this line to download and load the scene

    Code (CSharp):
    1. Addressables.LoadSceneAsync("DoorScene");
    Now I had already created an HTTP host and below-attached screenshot of what my hosting service looks like
    Screenshot 2019-07-30 at 19.47.33.png


    the good news is my scene is LOADING perfectly fine, but I am afraid that it's not loading the scene from my server

    and here are some question just came in mind if anyone can answer.

    1. Can I delete the addressable after I uploaded it to the server? so I can test that it is really loading from the server or not?
    2. Can I delete the actual scene and folder to do the test?
    3. How can I load the same uploaded content from a server in the new project or another project? by simply writing
    Code (CSharp):
    1. Addressables.LoadSceneAsync("DoorScene");
    will work? and if not then what are the procedure for the same?
    4. I am not able to understand how mentioning the port number in the Hosting screen only do the task for me? I am glad if anyone explains me the hosting thing.


    Very much thanks to the community, personally to @Favo-Yang!

    I feel that I understand 60% part of the addressable system, I am thinking of creating a good "WELL-WRITTEN" post and an example of Addressable once I understand it completely.
     
    phobos2077 and MoctezumaDev like this.
  16. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    361
    @mekartikshah good to see you got some progress. I'll explain more about the settings.

    In AddressableAssetSettings there're 5 profile entries.
    • LocalBuildPath, where the local bundle build to, bundles here will be copied to StreamingAsset folder and ship with app build.
    • LocalLoadPath, where the local bundle load from runtime.
    • You shall keep above unchanged.
    • RemoteBuildPath, where the remote bundle build to, it should be outside the Asset folder, and you're in charge to upload content here to your server. You shall revert it back to "ServerData/[BuildTarget]"
    • RemoteLoadPath, where the remote bundle located at, the default value is "http://localhost/[BuildTarget]" to work with embed hosting service in editor for testing. You may want to keep it as default to test in editor first. Then change to your remote server when testing against it.
    AssetGroups/GroupName, defines the group behaviour
    - To make a local group, leaves everything by default.
    - To make a remote group, change build path to RemoteBuildPath, and change load path to RemoteLoadPath. RemoteBuildPath and RemoteLoadPath are defined in the AddressableAssetSettings.

    In your case, you shall create a new group, and config as a remote group.

    To test in editor with embed hosting service
    • make sure the RemoteLoadPath set to "http://localhost/[BuildTarget]"
    • build the asset
    • switching Play Mode Script to "Packed Play Mode". (so it actually loads from built bundles)
    • start the hosting service as you did
    • play the game in editor and start debugging.
    To test against remote server
    • make sure the RemoteLoadPath set to your server address
    • build the asset
    • switching Play Mode Script to "Packed Play Mode". (so it actually loads from built bundles)
    • sync your RemoteBuildPath to server
    • visit your server address in browser, make sure it works
    • play the game in editor and start debugging.
    As said, this is the embed hosting service for testing. It starts a http service in editor with a random port. So it has nothing to do with Azure.

    I guess you're running in Fast Mode, so you haven't testing against bundles, but at least your addressable loading logic is correct.

    You can delete anything in your RemoteBuildPath

    Yon won't want to do it.

    No. Because addressable are not able to ship script changes. So all your scripts need exist within the app build. However some people ask the feature for other purpose, you may want to search the forum. I just forget the thread name.

    Thanks for the word. It's for other folks as well. We just learn more from each other.
     
  17. javierfed

    javierfed

    Joined:
    Apr 10, 2015
    Posts:
    25
    What are the requirements for our remote server? do we need to enable things like directory browsing? what kinds of permissions should there be? I have a remote server setup through go daddy, (web server hosting) and am hosting my bundle and catalog there. I have it configured enough to load individual files from urls, but does unity require something more for this to work? is there any problems with me using this to test assets that are bundled for mobile builds?

    sorry for so many questions, but I am so close to getting this working that I am eager to learn it all.
     
    phobos2077 likes this.
  18. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    709
    Not many. We just use an Azure blob and I have dumped stuff on an Apache-served directory before.

    No.

    If you do not want to have to do extra work with providers that use authentication and what not, you should just go by whatever permissions you need for your browser to be able to download the files if you paste the URL in.

    No.

    No, with fingers crossed. ;)
     
    phobos2077 and danilonishimura like this.
  19. javierfed

    javierfed

    Joined:
    Apr 10, 2015
    Posts:
    25
    Thank you for your fast replies. My build still fails to find the content, and actually acts weird when I build it... like, If I build using my "Local Online" profile, which loads from my own local hosted IIS website, everything works as expected. If I then switch to my "Production Online" profile, which loads from my online website, it too appeared to work fine.

    what is odd is if I clear my cache, Build with the Production profile and attempt to load, everything breaks. what appears to happen is if I build from my Local profile, and then switch to my online profile for loading, the whole application will continue to load as if from my local profile.

    I will be doing authentication through people's purchase receipts and the Ids of the products they purchase, at least that is the plan, so I won't need direct authentication at this time. but this loading issue is baffling. I never got it working outside of Addressable Assets, so this is all new territory to me.
     
  20. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    53
    @Favo-Yang I tried deleting the assets, addressable and actual files from asset folder and then I tried to loading, it loads the whole scene but it's not loading any other supporting folder or lighting data.

    When i tried the same thing in a new project by creating a new profile and changing "RemoteLoadPath" to [myserverpath] it gives me the error
    Code (CSharp):
    1. UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[UnityEngine.ResourceManagement.ResourceProviders.SceneInstance], result='', status='Failed': Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=DoorScene
    .

    Do you have any idea of how I can load the scene with all the supporting files and lighting data?

    Any idea of how I can load my scene and data to a new project from server like we used to do with asset bundle?
     
  21. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    361
    The changes of profile entries (XXXPath) are built into catalog.json, so you have to rebuild each time when switching the profile. It can be counter-intuitive.

    Further questions please consider create a new thread, this one is mixing with too much informations.
     
  22. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    361
    For lightning map, I'm not sure whehter this is related https://forum.unity.com/threads/cas...maps-in-addressable-scenes-are-broken.609796/

    I don't understand how you load other supporting folder, any example? If they're directly referenced from the addressable scene, then you won't need to mark those as addressable. Otherwise you need load them in script.

    The "DoorScene" key is invalid, have you build it? Please verify it in the catalog.json
    - Local catalog are located at ./Library/com.unity.addressables/StreamingAssetsCopy/aa/Windows/catalog.json
    - If you enabled "Build Remote Catalog" then locate it at you RemoteBuildPath

    You may also want to call Caching.ClearCache(); during development, so you always test against empty cache.

    Refs https://forum.unity.com/threads/load-addressableassets-created-with-another-unity-project.717464/



     
  23. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    53
    I am really sorry, I had not written any code to load supporting folders or lighting data, I just wrote code to load a scene that's it and that's why it's not loading my folder or data. Now, after this mistake, I realized that I don't know how to load the folder using Addressable :(


    Actually, I am very much used to AssetBundles and in AssetBundle I have a different dedicated project for building the asset bundles and then I upload it manually to the server and after uploading In my other project which is like a consumer - I have written my code to download and consume all the asset bundles, so I tried the same thing in Addressable.

    In my current project with addressable and all the assets, I have built the folders and scene with RemoteLoadPath and RemoteBuildPath and in both the links I have given my Azure Blob access link

    Now I had created another blank project add Addressable and gave the same RemoteLoadPath link and created a button and in that button's click I am loading the scene and it gives me the error mentioned above ^.

    Now, after watching lot many threads today i get a new perspective for Addressable

    - Addressable is not like traditional Assetbundle where you need two different projects for building and consuming the asset bundle instead it's more like a single big project which contains all the assets, scenes, and everything but once you make you asset or folder addressable and as per the "BundleAssetGroupSchema" path setting it decides automatically to ship with the build or to not ship with the build.
    for ex. in BundleAssetGroupSchema path if you change your path to "RemoteBuildPath" and in load to "RemoteLoadPath" then assets won't ship with the build instead it loads run time from the server as per your code logic and if needed.

    I really don't know if I understand the Addressable correct or not, and I am still facing the problem in uploading the asset to the server and download those addressable from the server. :(

    I tried building in ServerData folder and then manually copying the same to the server but not able to download from the server from the same path location.
     
    JDaze likes this.
  24. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    361
    I have a few screenshots may help.

    A new profile called "Remote Server". config as below

    1.PNG

    A new group called "Remote Group 1", config as below.
    Add one scene to it.
    2.PNG

    Set Profile: Remote Server
    Set Play Mode Script to Packed Play Mode
    Build > Build Player Content

    You will find the build data in ServerData folder.
    3.PNG

    Copy the StandaloneWindows64 folder to remote http server, and test with your remote load path. In this case, you shall test this url in browser http://example.com/StandaloneWindow...s_all_8d8356d04b4f6147b47203db6bc82460.bundle

    Start your app and watch the console for useful debug information. It should work.

    Next time you may want to call Caching.ClearCache(); first to clean the cache (downloaded asset bundle).

    Furthermore, you can try out Build Remote Catalog.

    upload_2019-7-31_23-36-41.png
     
  25. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    361
    BTW, if you find any issue, check your catalog.json and settings.json first. You may find some clues...

    upload_2019-7-31_23-45-44.png
     
  26. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    126
    Wow, thank you to Favo-Yang!
    I'm bookmarking this thread for future reference.
     
  27. mekartikshah

    mekartikshah

    Joined:
    Jan 10, 2017
    Posts:
    53
    @Favo-Yang Thanks man, you just solved my problem.

    listing below my mistakes so if anyone ever faced the same can solve the problem easily.

    1. Make sure you turn on "BuildRemoteCatalog" and change it to a proper path because, without content catalog you cannot load your asset bundle, it is as useful as your asset.
    2. if you set RemoteBuildPath with your server address - then you are misunderstanding something. Unity not able to build your asset bundles directly to your server, I repeat NEVER! you have built it somewhere in a folder outside asset folder and then manually copy-paste to your server, unity can load or download your asset directly from the server.
    3. I am trying to load from my Azure blob previously but it may have some serious accessing issues and that's why I tried today by creating custom IIS Server and loading data there and it works perfectly fine, I try later with azure.

    I think we cannot load addressable from one project to another project, I still need confirmation from a senior member or someone who worked on Addressable.

    Thanks, Community and @Favo-Yang
     
    phobos2077 and Favo-Yang like this.
  28. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    709
    You can. However, do not expect to have an easy time doing so at the moment. The workflow is not polished or nicely defined right now. In short, you will need to build your assets on the second project for both your target platform and editor. Then you will need to either initialise the addressables system with a blank catalogue and then use LoadContentCatalogueAsync to add the assets from the other project, or initialise the system with a settings.json file that already has all this stuff in. This means that even the editor will have to use packed mode at all times.

    Things are tricky when it comes to assets depending on things in your main project, something that is problematic even with raw asset bundles when using split projects.
     
    phobos2077, TZ-, tonialatalo and 2 others like this.
  29. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    111
    How do i download asset bundles manually?I dont want addressable system to download the assetbundle automaticaly (with the help of remote catalog) .Assume i have a xml file in the cloud which tells me the assetbundle name or asset bundle path.As soon as i open the game i would query the xml file for the assetbundle name and then i would download that specific assetbundle on demand.I was doing this easily using legacy assetbundles but it looks little tricky with this addressables system.Any Ideas or Hints??Thank you
     
  30. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    111
    Sorted thank you guys!!FYI, https://forum.unity.com/threads/change-remote-catalog-load-path-at-runtime.712052/
     
  31. JDaze

    JDaze

    Joined:
    Sep 19, 2018
    Posts:
    1
    Can I load/release old already exported assetbundles using Addressables?
    If so how?
    Good title. This is confusing.
     
unityunity