Search Unity

Providers what are those?

Discussion in 'Addressables' started by sebas77, Jun 5, 2019.

  1. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    upload_2019-6-5_14-30-52.png

    These fields looked like a bug to me at first, why are they two?

    upload_2019-6-5_14-32-43.png

    what are the other providers for? I tried JsonAssetProvider for our json, but didn't work (it was a random gut feeling test)
     

    Attached Files:

  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    the way addressables works is this...
    address -> uses catalog to map to -> location.
    That location has info about where it is, and locations of its dependencies.
    location -> uses locations to get -> dependencies
    location -> uses providers to provide -> stuff.

    if you mark something as addressable, and leave the group with the schema BundledAssetGroupSchema, then the thing ends up in an asset bundle. Making it end up somewhere else would require custom schemas and a custom build script.

    So by default, if you mark some asset (such as a json file, or prefab, or whatever) you end up with two locations...
    location {address: "tree", asset: "tree.prefab", dependencies: [tree_bundle]}
    location {address: "tree_bundle", asset: "tree_bundle.bundle", dependencies: []}


    so, the schema allows you to set two providers. One loads the bundle based on the location "tree_bundle". The other loads the tree out of the bundle with the location "tree".

    You can create custom providers to do things such as:
    - download your bundle in some custom/special way
    - decrypt your bundle
    - load your asset out of the bundle in a synchronous way.
    - load the bundle in a sync way.
    - print out logs
    - post to facebook.
    etc.

    since the provider and location mapping is created at build time, the schema needs to know how you'd like to provide your stuff.
     
  3. wechat_os_Qy09c5l3zFPnZMKM9T5g703_Q

    wechat_os_Qy09c5l3zFPnZMKM9T5g703_Q

    Joined:
    Jul 4, 2019
    Posts:
    1
    I want to test some basic assetbundle encrypt and decrypt in Addressable.

    When i build bundle, i add some bytes at the beginning of bundle binary data . I modify the AssetBundleProvider script , change one line :
    AssetBundle.LoadFromFileAsync(string path,uint crc,ulong offset) .
    With this offset set, i can successfully load the bundle with some bytes offset.
    Addressable works fine when i just use the LocalBuildPath and LocalLoadPath, but failed when i want to use the RemoteBuildPath and RemoteLoadPath. It seems like when unity try to download bundle from remote server, AssetBundleDownloadHandler failed to create assetbundle cache and unity editor just closed even without a crash window. I think it's because AssetBundleDownloadHandler and some unity native code doesn't have the same offset param just like when load bundle from local path.

    How can i solve this problem without do all assetbundle cache mechanic by myself ? Thank you. @unity_bill
     
    TerrenceRao likes this.