Search Unity

Question Using Addressables along with Google Play Asset Delivery.

Discussion in 'Addressables' started by Zulug, Jun 5, 2020.

  1. Zulug

    Zulug

    Joined:
    Sep 15, 2012
    Posts:
    5
    Hello! We are developing Unity game using Addressable Asset System. It is really great feature and it solves many problems. But we stuck in need to convert our game in Instant to deploy in Google Play Instant platform. Here is facts we need to follow:
    1. We use Addressables everywhere in the project and follow documentation regarding using and deploying assets.
    2. We need to deploy Android App Bundle file that includes apks plus all Asset Bundles with On Demand feature enabled (they should serve as remote asset bundles).
    3. The only way we found to pack Android App Bundle along with assets is to use Google Play Asset Delivery package. It can pack asset bundles and provide methods to load them at runtime.

    The problem is that we don't know how to use Addressable Assets Systems to use assets packed by Play Assets Delivery or pack Addressables Assets in .aab to use them On Demand.

    Is there such a way?
     
  2. chrisMary

    chrisMary

    Joined:
    Nov 27, 2013
    Posts:
    16
    Same here, I am in the process of converting my content to addressables, and was looking into best priced cdn, when I stumbled upon Google Play Asset Delivery...
    Is there a way to combine both?
     
    Vasiliy-V-V and JesOb like this.
  3. cleversons_unity

    cleversons_unity

    Joined:
    May 11, 2018
    Posts:
    8
    I'm also interested.
     
    Vasiliy-V-V and JesOb like this.
  4. GilbertoBitt

    GilbertoBitt

    Joined:
    May 27, 2013
    Posts:
    111
    OMG. we need this
     
    Vasiliy-V-V and JesOb like this.
  5. Vasiliy-V-V

    Vasiliy-V-V

    Joined:
    Dec 9, 2013
    Posts:
    7
    I'm need it too.
     
  6. Fuduin

    Fuduin

    Joined:
    Feb 7, 2020
    Posts:
    7
  7. supersolid-jelte

    supersolid-jelte

    Joined:
    Dec 3, 2018
    Posts:
    22
    I literally did this yesterday :)
    Thnk @Fuduin for linking, I'll repost it here

    (note: updated post)

    Steps:

    Preprocessor to remove all bundles (except catalog.bundle) from streaming assets folder
    This is to not include them in the base build, they will be added via the AssetPackConfig.

    Code (CSharp):
    1. public class AddressablesPlayerBuildAndroidProcessor : IPreprocessBuildWithReport
    2. {
    3.     public int callbackOrder => 2;
    4.  
    5.     public void OnPreprocessBuild(BuildReport report)
    6.     {
    7.         IEnumerable<string> bundles = Directory.GetFiles(Addressables.PlayerBuildDataPath)
    8.             .Where(file => file.EndsWith(".bundle"))
    9.             .Where(file => !file.EndsWith("catalog.bundle"))
    10.             .ToDictionary(file => file, AssetPackBuilder.GetAssetPackGroupSchema)
    11.             .Where(pair => pair.Value != null)
    12.             .Select(pair => pair.Key);
    13.         foreach (string bundle in bundles)
    14.         {
    15.             File.Delete(bundle);
    16.         }
    17.     }
    18. }
    Callback order is import as you want it happening after the addressables Preprocessor, which copies the asset bundles to the StreamingAssets folder (PlayerBuildDataPath).

    Generate AssetPackConfig based on all other bundles.
    This is called during our build process after the addressables have been processed.

    Update: Use AssetPackGroupSchema to determine which bundles should be included in an asset pack.

    Code (CSharp):
    1.  
    2. class AssetPackBuilder
    3. {
    4.      public static AssetPackConfig CreateAssetPacks()
    5.      {
    6.           IEnumerable<Tuple<string, AssetPackGroupSchema, string>> bundles = Directory.GetFiles(Addressables.BuildPath)
    7.               .Where(file => file.EndsWith(".bundle") && !file.EndsWith("catalog.bundle"))
    8.               .Select(file => new Tuple<string, AssetPackGroupSchema, string>(file, GetAssetPackGroupSchema(file), Path.GetFileNameWithoutExtension(file)))
    9.               .Where(pair => pair.Item2 != null);
    10.           foreach (var bundle in bundles)
    11.           {
    12.               assetPackConfig.AssetPacks.Add(bundle.Item3,     bundle.Item2.CreateAssetPack(bundle.Item1));
    13.           }
    14.           return assetPackConfig;
    15.      }
    16.  
    17.      public static AssetPackGroupSchema GetAssetPackGroupSchema(string bundle)
    18.      {
    19.           return AddressableAssetSettingsDefaultObject.Settings.groups
    20.               .Where(group => group.HasSchema<AssetPackGroupSchema>())
    21.               .Where(group => Path.GetFileName(bundle).StartsWith(group.Name))
    22.               .Select(group => group.GetSchema<AssetPackGroupSchema>())
    23.               .FirstOrDefault();
    24.      }
    25. }
    26.  
    the result is passed to
    Bundletool.BuildBundle


    Add custom AssetBundleProvider to asset bundles.
    Note: I'm using a very custom AssetBundle Provider, which handles delivering asset bundles synchronously after initial launch. As that is part of project I work on, I'm unable to share the entire code. But it is based on the default unity implementations.

    Basic idea is that after checking if file path exists locally and before using a web request. The provider will check if the bundle is part of an asset pack. Here I do it very quickly by checking if the path starts with RuntimePath and ends with .bundle.

    Code (CSharp):
    1.  
    2.     internal class CustomAssetBundleResource : IAssetBundleResource
    3.     {
    4. ...
    5.         private void BeginOperation()
    6.         {
    7. ...
    8.             if (File.Exists(path))
    9.             {
    10.                 ...
    11.             }
    12.             else if (TryHandleAssetPackFileAsynchronously(path))
    13.             {
    14.                 return;
    15.             }
    16.             else if (ResourceManagerConfig.ShouldPathUseWebRequest(path))
    17. ...
    18.         }
    19.  
    20.         private bool TryHandleAssetPackFileAsynchronously(string path)
    21.         {
    22.             if (!path.StartsWith(Addressables.RuntimePath) || !path.EndsWith(".bundle"))
    23.             {
    24.                 return false;
    25.             }
    26.             string assetPackName = Path.GetFileNameWithoutExtension(path);
    27.             playAssetPackRequest = PlayAssetDelivery.RetrieveAssetPackAsync(assetPackName);
    28.             playAssetPackRequest.Completed += request => OnPlayAssetPackRequestCompleted(assetPackName, request);
    29.             return true;
    30.         }
    31.  
    32.         private void OnPlayAssetPackRequestCompleted(string assetPackName, PlayAssetPackRequest request)
    33.         {
    34.             if (request.Error != AssetDeliveryErrorCode.NoError)
    35.             {
    36.                 m_ProvideHandle.Complete(this, false, new Exception($"Error downloading error pack: {request.Error}"));
    37.                 return;
    38.             }
    39.             if (request.Status != AssetDeliveryStatus.Available)
    40.             {
    41.                 m_ProvideHandle.Complete(this, false, new Exception($"Error downloading status: {request.Status}"));
    42.                 return;
    43.             }
    44.             var assetLocation = request.GetAssetLocation(assetPackName);
    45.             m_RequestOperation = AssetBundle.LoadFromFileAsync(assetLocation.Path, /* crc= */ 0, assetLocation.Offset);
    46.             m_RequestOperation.completed += LocalRequestOperationCompleted;
    47.         }
    48. ....
    49. }
    50.  
    It's also possible to load the bundle from the asset pack synchronously :) (atleast for fast-install, haven't tested rest.) (note: this is a requirement for the project I work on, so it's great that it works ;))
    Code (CSharp):
    1.  
    2.         private bool TryHandleAssetPackFileSynchronously(string path)
    3.         {
    4.             if (!path.StartsWith(Addressables.RuntimePath) || !path.EndsWith(".bundle"))
    5.             {
    6.                 return false;
    7.             }
    8.             string assetPackName = Path.GetFileNameWithoutExtension(path);
    9.             playAssetPackRequest = PlayAssetDelivery.RetrieveAssetPackAsync(assetPackName);
    10.             Exception exception = null;
    11.             if (playAssetPackRequest.IsDone)
    12.             {
    13.                 // asset pack was downloaded on initial launch of the game, so it should be done when loading it synchrounsly.
    14.                 var assetLocation = playAssetPackRequest.GetAssetLocation(assetPackName);
    15.                 m_AssetBundle = AssetBundle.LoadFromFile(assetLocation.Path, /* crc= */ 0, assetLocation.Offset);
    16.             }
    17.             else
    18.             {
    19.                 exception = new Exception($"Asset Pack was not retrieved asynchronously: '{assetPackName}'.");
    20.             }
    21.             m_ProvideHandle.Complete(this, m_AssetBundle != null, exception);
    22.             return true;
    23.         }
    24.  
    Download progress
    This is currently not working because addressables still thinks of the asset bundle as being a local bundle and not a remote.
    So when it computes the download size it returns 0. The data for this is generated during the building of the asset bundles, changing this would require a custom build script (copy & changing the existing default one doesn't work as it depends on a lot of internals...).

    The solution to this is to call `PlayAssetDelivery.GetDownloadSize` for each pack that needs to be downloaded (sadly no combined call for this).

    improvements
    for production ready code, you'll probably will need to handle things like waiting for wifi (for large packs larger than 150MB), errors and per bundle configuration so you can specify the AssetPackDeliveryMode for each bundle (probably via adding a Schema to the Group).

    Code (CSharp):
    1.  
    2.     [DisplayName("Play Asset Delivery")]
    3.     public class AssetPackGroupSchema : AddressableAssetGroupSchema
    4.     {
    5.         public enum AssetPackDeliveryMode
    6.         {
    7.             InstallTime = 1,
    8.             FastFollow = 2,
    9.             OnDemand = 3,
    10.         }
    11.      
    12.         [SerializeField]
    13.         AssetPackDeliveryMode deliveryMode;
    14.     }
    15.  
    note
    the current game I'm working is in no rush to add support for this as we are currently projected to be at the AAB cap in 8 to 9 months :), but it was a fun exercise and test to see if this would work.
     
    Last edited: Sep 7, 2020
  8. supersolid-jelte

    supersolid-jelte

    Joined:
    Dec 3, 2018
    Posts:
    22
    Stupid spam protection not allowing me to update my post :( saw it was missing a method in the AssetPackGroupSchema

    Code (CSharp):
    1.  
    2.         public AssetPack CreateAssetPack(string bundle)
    3.         {
    4.             return new AssetPack
    5.             {
    6.                 DeliveryMode = (PlayAssetPackDeliveryMode) deliveryMode,
    7.                 AssetBundleFilePath = bundle
    8.             };
    9.         }
    10.  
     
    lucbloom likes this.
  9. Zulug

    Zulug

    Joined:
    Sep 15, 2012
    Posts:
    5
    Hey @Fuduin thank you for the link!
    @supersolid-jelte much appreciate for the full solution. I'll check it on occasion. This is a great feature!
     
  10. supersolid-jelte

    supersolid-jelte

    Joined:
    Dec 3, 2018
    Posts:
    22
  11. bali33

    bali33

    Joined:
    Aug 14, 2011
    Posts:
    232
    This should work out of the box and I don't understand why Unity has not already deliver a solution to be compatible with Play Asset delivery. @unity_bill can we expect a solution soon ?
     
    iivanovazur and p0w1nd like this.
  12. pamfeeling

    pamfeeling

    Joined:
    Dec 31, 2019
    Posts:
    2
  13. supersolid-jelte

    supersolid-jelte

    Joined:
    Dec 3, 2018
    Posts:
    22
    @pamfeeling I've just released the first Release Candidate. Hopefully the README provides enough information :)
    It's a little untested at the moment, but I got it planned to be included in the next release of our game, scheduled mid-November. At which point this implementation will have gone through a proper QA process and not just dev-testing.
     
    iivanovazur likes this.
  14. bali33

    bali33

    Joined:
    Aug 14, 2011
    Posts:
    232
    First post is from june and still no Unity staff answer. I'm have already switched to AssetBundle instead AddressableAssets but it's quite note as convenient as AddressableAsset. We really need a solution to use them. Unity push users to use it and still provides no solution to use it with Google Play Asset Delivery.

    @unity_bill , @TreyK-47 we need an update/answer/solution here.

    Thanks
     
    iivanovazur and wsweazey like this.
  15. sidespin

    sidespin

    Joined:
    Jun 22, 2018
    Posts:
    20
    Can someone from Unity provide some comment on this? Is there an ETA? Or are you not going to do this? It's been 5 months.
     
  16. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    I'll flag this for the team, and will pass along any updates they have to share!
     
  17. bali33

    bali33

    Joined:
    Aug 14, 2011
    Posts:
    232
    Finally an answer ! Thanks.

    Please, use a red flag ;-)
     
    Last edited: Nov 6, 2020
  18. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Sorry for missing this thread for so long. The short answer is, we are currently looking into this (literally had meetings over the past couple weeks with various teams in Unity to get our heads wrapped around it). How we'll support this in the future is still a little fuzzy. Perhaps a native feature within addressables, perhaps with clear documentation, perhaps something else.

    Either way we do know this needs some guidance.

    In the interim, I can give advice based on my current understanding of Google's plugin, though I admit I could misunderstand some aspects.

    Overall, my advice is pretty close to what was already posted in this thread by @supersolid-jelte. The only alterations I might give would be that I think some situations could simplify the flow, but the overall description is likely best for many cases.

    My short version...
    To build the content, you currently need the Google plugin to build the bundles into their format. But it's worth noting, their tool takes bundles as an input, and Addressables build gives bundles as an output. So you just need to set the addressables build output path to wherever you are building the asset pack from. In the sample above it's building to StreamingAssets and then moving the files. Not sure why that step is needed.

    At runtime, you have a couple options. If you want content on-demand, then you need the custom provider that is shown above. If you are good with the entire download happening in advance, then I believe you can either just set a different load path, or at minimum have a much simpler provider. In this instance, it would not be Addressables triggering the download.

    Again, I know a high level guide isn't quite what everyone is looking for. We are chasing down a good solution now and will keep you posted.
     
  19. alexds9

    alexds9

    Joined:
    Feb 9, 2019
    Posts:
    16
    Any updates when Google Play Asset Delivery with Unity Addressable will be supported?
    Can you provide an example or tutorial how to make it work for now?
     
    Ghetaldus, io-games, ReSY and 2 others like this.
  20. FlyVC

    FlyVC

    Joined:
    Jan 5, 2020
    Posts:
    30
    I would really appreciate an "official" guide on this, from mid-2021 Google is forcing us to use the Android App Bundles with its 150MB limitation, the widely used apk + obb file combination will not be possible anymore!
     
    domonyiv, ocnenued, Chrysto and 2 others like this.
  21. kkostenkov

    kkostenkov

    Joined:
    Jun 3, 2019
    Posts:
    1
    Dear devs, do you have any news or expectations on this topic?
     
    domonyiv likes this.
  22. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Update: The mobile team at Unity is still finalizing the basic Unity & PAD integration. Once that's done, we'll work on integrating it into addressables. I can't really speak to estimates on either front other than to say we are aware of the urgency and want to see this resolved.

    I will say the work the mobile team is doing does require engine changes. Once those are in, there is intent to backport them to 2020LTS, but again, timelines on all this is unclear at the moment.

    Sorry I can't have a better answer yet
     
  23. bali33

    bali33

    Joined:
    Aug 14, 2011
    Posts:
    232
    Hello,

    Thanks for the update. Are we talking about weeks, months, half-year, year, years ?
     
  24. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    If I understand right there are 2 phases. First is the basic Unity & PAD integration and the second is the addressables, right?

    What does the "basic" integration means? We can build an AAB like before without any google plugins and Unity will handle the PAD side?
     
    lucbloom likes this.
  25. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    129
    I'm very worried about unity productivity, and I don't think unity will solve this problem before August arrives
     
  26. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    A month has passed, any news on this? :) @unity_bill
     
  27. peakcoder

    peakcoder

    Joined:
    Nov 30, 2013
    Posts:
    1
  28. Paulx774

    Paulx774

    Joined:
    Mar 18, 2021
    Posts:
    103
    I would like to hear an update about this or any estimated ETA. @unity_bill

    All of my projects are strictly based on the addressable system. I even created my own package for addressable system to handle many things automatically. Will it be released in this year?
     
  29. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Hi all no update yet. Status is still the same as what @unity_bill posted in March. We hope to have at least minimal support in the coming months.

    @domonyiv Yes exactly as you described. There will be new Unity APIs that support PAD.
     
  30. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Hi @pillakirsten, @unity_bill, @TreyK-47. I think this feature needs to deliver asap before August 2021 as google set the hard requirement to utilize Play Asset Delivery or Play Feature Delivery when download size over 150MB and expansion file (OBB) will not supported anymore.
     
    phobos2077 and domonyiv like this.
  31. MatL

    MatL

    Joined:
    Jan 29, 2014
    Posts:
    43
    I am really disappointed that is not supported by addressables, having an estimation on where is going to be implemented would be helpful to decide what we do.
     
  32. Rand_D

    Rand_D

    Joined:
    Oct 24, 2017
    Posts:
    44
    Hi can someone fill me in with some information. My game uses addressable (but only for local path, no remote path yet). I can build apk and test apk ok. But when I build .aab and publish it, the downloaded apk from the Play Store is broken. What causes this and what should i do ?
     
    iivanovazur likes this.
  33. Jonas-Neuston

    Jonas-Neuston

    Joined:
    Jun 10, 2017
    Posts:
    70
    Our team is also waiting for news on Unity support for Addressables and Play Asset Delivery.
     
  34. RaventurnPatrick

    RaventurnPatrick

    Joined:
    Aug 9, 2011
    Posts:
    250
    According to Google: https://developer.android.com/google/play/expansion-files
    the current method used by Unity (*.obb - split application binary) is already deprecated and will not be allowed from August this year!
    So pretty much all Unity Games on the play-store (as I assume most are larger than 150MB) will have a pretty big problem by then.
    Can you update us whether Unity will be able to provide us with a solution within the next 2 months? Otherwise we will have to start integrating Play Asset Delivery ourselves
     
  35. Paulx774

    Paulx774

    Joined:
    Mar 18, 2021
    Posts:
    103
    Actually, that's for the new applications. Already published applications have deadline of November 2021.
     
    Andrey2Akimov likes this.
  36. RaventurnPatrick

    RaventurnPatrick

    Joined:
    Aug 9, 2011
    Posts:
    250
    Andrey2Akimov likes this.
  37. drallcom3

    drallcom3

    Joined:
    Feb 12, 2017
    Posts:
    165
    Andrey2Akimov likes this.
  38. Paulx774

    Paulx774

    Joined:
    Mar 18, 2021
    Posts:
    103
    Then the guy in below thread directed me wrong :) I asked this question before. I thought the same thing. Existed apps don't need to update their apps to the new PAD system, but the guy in the thread told me the deadline is November 2021.

    https://forum.unity.com/threads/what-will-happen-to-the-games-with-obb-files-after-august.1112566/
     
  39. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    AllanPoe likes this.
  40. maguslin

    maguslin

    Joined:
    Mar 9, 2015
    Posts:
    9
    any news on this?
     
  41. maguslin

    maguslin

    Joined:
    Mar 9, 2015
    Posts:
    9
  42. yudan_felix

    yudan_felix

    Joined:
    Aug 26, 2014
    Posts:
    1
    Any News?Our app will release on August.
     
  43. aimatme

    aimatme

    Joined:
    Jul 3, 2012
    Posts:
    24
    also waiting for news
     
  44. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    129
    I expressed my concerns in April this year (#25), and I will do so again
     
  45. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    In case anyone needs to get this working until August like I do, here's my first working draft of a simple custom AssetBundleProvider that works in Unity 2021.1.12 (Addressables 1.18.9).

    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using Google.Play.AssetDelivery;
    4. using JetBrains.Annotations;
    5. using System.ComponentModel;
    6. using System.IO;
    7. using UnityEngine.ResourceManagement.ResourceLocations;
    8. using UnityEngine.ResourceManagement.ResourceProviders;
    9. using AsyncOperation = UnityEngine.AsyncOperation;
    10.  
    11. [DisplayName("Custom AssetBundle Provider")]
    12. [UsedImplicitly]
    13. public class CustomAssetBundleProvider : AssetBundleProvider
    14. {
    15.     public override void Provide(ProvideHandle providerInterface)
    16.     {
    17.         new AssetPackResource().Start(providerInterface);
    18.     }
    19.  
    20.     public override void Release(IResourceLocation location, object asset)
    21.     {
    22.         if (location == null)
    23.             throw new ArgumentNullException(nameof(location));
    24.  
    25.         if (asset == null)
    26.         {
    27.             Debug.LogWarningFormat(
    28.                 "Releasing null asset bundle from location {0}. " +
    29.                 "This is an indication that the bundle failed to load.",
    30.                 location);
    31.             return;
    32.         }
    33.  
    34.         if (asset is AssetPackResource syncResource)
    35.             syncResource.Unload();
    36.     }
    37.  
    38.     internal class AssetPackResource : IAssetBundleResource
    39.     {
    40.         private ProvideHandle provideHandle;
    41.         private AssetBundle assetBundle;
    42.         private string path;
    43.  
    44.         public AssetBundle GetAssetBundle()
    45.         {
    46.             return assetBundle;
    47.         }
    48.  
    49.         internal void Start(ProvideHandle provideHandle)
    50.         {
    51.             this.provideHandle = provideHandle;
    52.  
    53.             path = Path.GetFileNameWithoutExtension(provideHandle.Location.InternalId);
    54.  
    55.             Debug.Log("Starting AssetBundleResource: " + path);
    56.  
    57.             var assetPackRequest = PlayAssetDelivery.RetrieveAssetPackAsync(path);
    58.            
    59.             Debug.Log("Waiting for complete AssetBundleResource: " + path);
    60.             assetPackRequest.Completed += OnAssetPackRequestCompleted;
    61.         }
    62.  
    63.         private void OnAssetPackRequestCompleted(PlayAssetPackRequest assetPackRequest)
    64.         {
    65.             Debug.Log("Complete AssetBundleResource: " + path);
    66.             if (assetPackRequest.Status == AssetDeliveryStatus.Failed)
    67.                 Debug.LogError("Failed with error code: " + assetPackRequest.Error);
    68.  
    69.             var bundleRequest = assetPackRequest.LoadAssetBundleAsync(path);
    70.             Debug.Log("Load Bundle request: " + path);
    71.             bundleRequest.completed += OnBundleRequestCompleted;
    72.         }
    73.  
    74.         private void OnBundleRequestCompleted(AsyncOperation asyncOperation)
    75.         {
    76.             Debug.Log("On bundle load request completed: " + path);
    77.             var createRequest = (AssetBundleCreateRequest)asyncOperation;
    78.             this.assetBundle = createRequest.assetBundle;
    79.             Debug.Log("AB: " + assetBundle);
    80.             if (this.assetBundle == null)
    81.                 Debug.LogError("Failed to load AssetBundle.");
    82.  
    83.             provideHandle.Complete(this, assetBundle != null, null);
    84.         }
    85.  
    86.         internal void Unload()
    87.         {
    88.             if (assetBundle != null)
    89.             {
    90.                 assetBundle.Unload(true);
    91.                 assetBundle = null;
    92.             }
    93.         }
    94.     }
    95. }
    I put this custom provider on all of my groups to get a simple version working.

    For the build, the basic idea is simple:
    - Build Addressable content
    - Create Google AssetPackConfig with the bundle paths
    - Call Google's Bundletool.BuildBundle to take all Addressable AssetBundles and convert them into Google AssetPacks and also build the AAB file
    - Somehow make sure that the Addressables bundles are stripped from the player during the build (e.g. not include them via StreamingAssets)

    The last point was a little tricky since I didn't know how to configure Addressables in a way that made it possible to gather the bundles but then strip them in time for the build. My solution was to point Google to the Library location where Addressables builds bundles to and in OnPreprocessBuild move all bundles from StreamingAssets back into the Library location.
     
    orb_9 likes this.
  46. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    I don't understand. This page in the manual says that unity should automatically build asset packs when building App Bundle based on StreamingAssets folder: https://docs.unity3d.com/2020.3/Documentation/Manual/play-asset-delivery.html

    Local addressable bundles are placed and loaded from StreamingAssets. Does it mean it should just work without any custom providers or such? (assuming I don't need on-demand loading, just loading everything up-front is fine).

    What am I missing here?
     
  47. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    upload_2021-7-13_20-39-10.png
    Why does it say "Split Application Binary is disabled when building Android AppBundle" if that's exactly what the manual wants you to do:
    "To use Play Asset Delivery, you need to set up your project to build Android App Bundles and split the application binary."

    Is this a lie or what? :)
     
    Xarbrough likes this.
  48. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    Good questions! I never found that page in the docs, only people complaining about lack of support for PADs, so I just downloaded the Google plugin myself and did the awkward dance, but it's still really hacky, so I would be glad if Unity had support for this builtin.

    EDIT: I've gone through that documentation page. It doesn't mention Addressables, so that would be the first big point. There's no official support for Addressables + PAD. But even for regular scenes or AssetBundles, the doc page must be incorrect. Maybe they wrote it preliminary and forgot that it's not yet released or something. I tried to follow the steps exactly, but the split application option is grayed out and the AAB file is just a regular AAB file with a single base APK that contains all assets (including bundles in StreamingAssets) within the "assets" folder of said APK. But that's not what PAD needs. I did the thing with Google's plugin and the generated AAB looks totally different.

    On the left is the AAB generated by Unity, on the right is the one generated by Google's Plugin and it shows how the base folder contains the core app, but all of the Asset Packs (Google Bundles) are placed top-level and separate from the base APK.
    upload_2021-7-13_20-36-47.png
     
    Last edited: Jul 13, 2021
    phobos2077 likes this.
  49. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    So a lie then... not surprised :D

    What Google plugin are you using btw?

    If it just worked like described in docs for StreamingAssets, there's no need for explicit support. Just putting the whole folder into one big asset pack would satisfy our needs.. but seems that's not what's happening.
     
  50. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188