Search Unity

Asset Bundles with Multiplatform on Dev & Live

Discussion in 'Asset Bundles' started by omerelfassy, Sep 8, 2017.

  1. omerelfassy

    omerelfassy

    Joined:
    Nov 9, 2015
    Posts:
    20
    My game (Runewards) is available for PC & Android devices and future release in IOS using Asset Bundles for each platform separatly.

    We’ve created 3 folders, each represents the platform it should be worked on.
    • 1_Global – assets that we use on both platforms, pc & mobile.
    • 2_PC - assets that we use only for PC.
    • 3_Android – assets that we use only for Android.


    We’ve uploaded the Asset Bundles to Google CDN, separated to 3 folders (PC, Android and IOS – future release…)



    We’re using Gamesparks backend service (Server-Side) and we put all the links on the SQL à Runtime collection.



    When player is logging in the game (with any platform), he is downloading the Asset Bundles from Google CDN.

    So far so good…

    Now the thing is that we’re doing everything manually, meaning that if we’ve added an Asset to 1 of the Asset Bundles, we have to update the version in the Server-Side so the player will download the newer Asset Bundle when he logs into the game. Is there any way to indicate which file has been updated and has a new asset now? (Like a Laungher/Patcher).

    Another thing is, that we have 2 workspaces, Dev and Live... so while preparing the next patch, how can I push it to the live without interrupting the players that are currently downloading the files from Google?
    At the moment i've found a solution that i've created 2 Live folders in Google CDN, and when i release a patch, i update all the links on the Server-Side (SQL Runetime collection) so the player will get the new path (links) to the newer Asset Bundles, i'm not sure if there is an easier way, but so far it's working...

    If you have any suggestions for a better work, please let me know.
     
  2. nilsk123

    nilsk123

    Joined:
    Dec 13, 2016
    Posts:
    19
    Hi Omer,

    Typically when generating assetbundles Unity will also generate a manifest assetbundle, it has the name of the platform your current build setting targets. This manifest contains the names of all generated bundles, the bundles they depend upon (ie. material needs texture), and a unique hash. When a bundle changes (because you add/remove/change an asset) the hash also changes.

    When using the WWW or UnityWebrequest class to download an assetbundle, you can pass it the hash that's known in the manifest (https://docs.unity3d.com/ScriptReference/AssetBundleManifest.html). If it finds the bundle with that hash in the local cache, it'll use that instead of downloading. In our setup, after downloading an assetbundle we use the Caching.ClearOtherCachedVersions (https://docs.unity3d.com/2017.1/Documentation/ScriptReference/Caching.ClearOtherCachedVersions.html) to ensure only the most recent copy is stored. Using this system, you can dynamically and incrementally allow your users to patch their local bundles.

    As far as the question about workspaces goes, our solution is about the same as yours. We upload different content versions to different folders and pass the appropriate link to the client when it starts.