Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

How to prove the asset was downloaded from remote

Discussion in 'Addressables' started by DeanGiddy, Jan 28, 2019.

  1. DeanGiddy

    DeanGiddy

    Joined:
    Oct 30, 2018
    Posts:
    2
    We have a project where there is a bundle group with its build and load paths set to remote build and load paths. The results of the asset build are uploaded to our web server www.xxx/folder/ resulting in our remote load path being www.xxx/folder/Standalone64.

    Our use case is that we want to be able to download the assets from the server even though the original asset does not exist in the build. When we delete the addressable asset from the group

    Code (CSharp):
    1. Addressables.Instantiate<GameObject>(address)
    will throw an InvalidKeyException. Makes sense, because the key/address is no longer in the asset bundle group because the group is now empty.

    However, if we simply make a prefab of an empty gameobject, make it addressable in the same group and give it the same address/key (effectively replacing the asset with a new one) the empty game object will be instantiated despite the fact that on our server we still have the bundle of our original prefab which was given the same address and our group's load path is correct.

    This basically proves that we were never downloading from the server in the first place.

    How can we be sure that our asset bundle is actually being downloaded from the server and is it possible to download a remote asset without needing the original asset included in the group in the editor.

    We have also tried using

    Code (CSharp):
    1. Addressables.LoadCatalogsFromRuntimeData(catalogPath).Completed += LoadCatalogsCompleted;
    where catalogPath is the exact path to our catalog.json hosted on our web server.
     
  2. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    327
    I'm confused. Your setup is:
    -someGroupSetupForServer
    -- assetX

    so you do a build, assetX is put in a bundle, you put the bundle on the server. At this point, LoadAsset("assetX") should work, and should download.

    Where I'm lost is that you're then deleting the asset from your group? Why are you doing that?
     
  3. DeanGiddy

    DeanGiddy

    Joined:
    Oct 30, 2018
    Posts:
    2
    So our issue was that our server (on azure) required a web.config file that defined how to process .hash, .json and .bundle files.

    We were deleting the asset from the group locally because we wanted no trace of the original asset in the project folder when downloading assets. And it works! But now we have a slightly more complicated issue. Our end goal is for a standalone application to be build with an empty group and that other developers with their own project folders can build their own asset bundles to be uploaded to the same server and our database would log the asset's catalog path and address name.

    What we found is that the addressable system's player cache will only recognize bundles created in the most recent build from that specific project. For example, in my first build I could build a group with an orc enemy that was given the address "Enemy". But a later content build with a mage prefab marked with the same address instead of the orc, the mage asset will be the one to be downloaded from the server through the address "Enemy" even if both bundles are there with their catalogs. This told us that the system prioritized the latest build. Fair enough.

    We tried the same thing again but with both prefabs having two different addresses. So actually addressing them as "Orc" and "Mage" but still creating them in separate content builds one after another where the asset group only contains one of those prefabs each time because our end goal requires that builds of individual assets can be made in isolation from each other.

    When trying to load the Orc prefab again, this time with its unique address, the application didn't recognize the key but it would recognize the Mage address and therefore load it. Even when trying to load the orc's catalog during runtime, we still could not load the orc prefab by it's address. Only the mage.

    Is it possible to extend the runtime catalog of assets with asset bundles of prefabs created in isolation from both one another and from the application project itself?

    Our use case for this is an app that contains no models, presents a list of assets available on the server through checking our database, and loading a selected asset. The assets themselves may be created by our team or another team in a different region, but we would still upload the asset through a web portal to add it to both our server and our database so that during application runtime, we can point the app to any one of these foreign addressable assets. Can this be done? Are their any workarounds with getting this to work?
     
  4. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    327
    If you're talking about internally having multiple Unity projects, and loading multiple catalogs, we do have support for that. It's not really documented, but that's on the list to document and/or have examples for soon. The short version is you have to have each unity project create it's own catalog, then have a master unity project that understands how to load multiple catalogs. We have a couple known bugs for this in 0.5.3 that should be fixed in the next release.

    If you're talking about catalog hacking for the purpose of user modding, that's another story. That too is doable, but is uncharted & undocumented territory. Unfortunately the only advice I can give here is to poke around in our code to see what you can learn. If you are not already familiar with asset bundles, how they work, and their limitations, it will probably be quite difficult to do.

    -Bill