Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

AAB support : does that mean we don't need to use PAD ?

Discussion in '2021.2 Beta' started by bali33, Jun 22, 2021.

Thread Status:
Not open for further replies.
  1. bali33

    bali33

    Joined:
    Aug 14, 2011
    Posts:
    232
    Hello,

    The release note on the blog says:

    In 2021.2, Unity provides direct support for Android’s new expansion file format, Android App Bundle (AAB) for asset building. Using AAB, developers can meet the Google Asset Delivery requirements to publish any new apps to Google Play.

    So far, when my application is above 150 Mo I have to use Google Play Asset Delivery feature in order to be able to upload my app. What this new feature will change exactly ?

    Thanks
     
    M_R and JesOb like this.
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    The new feature will use Play Asset Delivery functionality (you can follow this link to read more about it https://developer.android.com/guide/playcore/asset-delivery ) to provide a similar functionality to what was available with apk + obb. What was packed in obb previously will now be packed into asset packs inside of the AAB. Note that OBB had only two limits:
    1. file count limit (main obb and patch obb, where only main obb could be automatically generated by Unity)
    2. size limit (up to 2GB per file)
    however the new system has much more limitations and some manual project adaptations might be needed when switching from APK + OBB to Asset Packs in AAB. If your current APK + OBB setup is smaller than 1GB, then most likely no project changes will be required apart from changing build type from APK to AAB. In other cases there will be required changes to the project based on the size and the way it is set up. It will be also possible to create custom Asset Packs regardless of automatic application splitting by Unity.
     
  3. bali33

    bali33

    Joined:
    Aug 14, 2011
    Posts:
    232
    Hum ... so not sure what is the benefit here ? As of now our OBB files are created from AssetBundles and the very reason we use OBB files is because our app size is greater than the 150 Mo limits. With AAB file do we still have to pack assets using AssetBundle and then retrieve those using PAD ? If so, what is the benefit ?

    Thanks.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    Presumably this works even if you don't use AssetBundles.

    It's to create a bridge for those that were relying on APK + OBB, or people that simply don't want to use asset bundles, and don't want to restructure their games to be able to publish on Google Play with aab.

    I appreciate it.
     
    Last edited: Jun 22, 2021
  5. bali33

    bali33

    Joined:
    Aug 14, 2011
    Posts:
    232
    @AcidArrow how will that prevent to use AssetBundle ? Genuinely question here, because when your app is over 150Mo you have one way or another create OBB file or assets packs which I think (but I might be wrong) are created from AssetBundles and then retrieved using the PAD API. I'm not quite sure for asset packs, so maybe I'm missing something here.
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    My understanding for the Unity feature is that the asset packs are auto generated (if final build is less than 1gb) and you don’t have to create or use asset bundles.
     
  7. bali33

    bali33

    Joined:
    Aug 14, 2011
    Posts:
    232
    In that case it would be a really great news !
     
  8. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    AcidArrow is correct. This will not force the project to use asset bundles, The main idea right now is exactly as AcidArrow said "It's to create a bridge for those that were relying on APK + OBB", so if your build with OBB was less than 1GB, the only thing you should need to do when the feature is available is to switch the output format from APK to AAB. If the final build is bigger than 1GB, then due to asset pack limitations, you might have to do some manual project changes and you would also have to ensure required asset packs are downloaded (there will by new Unity APIs for that which will be wrapping PAD APIs).
     
    ManOfDrive, AcidArrow and bali33 like this.
  9. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Please note that current ios ODR implementation dont support install time tags we need to go into xcode and setup them manually

    When you will create api for PAD dont forget to realise install time tags (install, follow up, on demand)

    And will be very nice if you add them to ODR implementation along with ability to check for downloaded packs :)
     
    Neonlyte likes this.
  10. zeprocha

    zeprocha

    Joined:
    Feb 27, 2019
    Posts:
    2
    I have a question , is these PAD API already availbale in the new unity 2021.2b?

    I've just compiled my app successfully with this unity version, but i receive the warning that my aab is bigger then 150mb, and Play Console dosesnt accept it .. once i remove everything on the StreamingAssets folder and recompile the app, i get an aab with 113Mb only.

    Generating an app bundle, in 2021.2 has the same result as generating in 2021.1, at least for now. I was wondering how could i user Google PAD in Unity without AssetBundles.

    What am i missing?
     
    Last edited: Jul 5, 2021
  11. haruto-otake

    haruto-otake

    Joined:
    Aug 27, 2014
    Posts:
    2
    @JuliusM

    In Google's implementation, it is possible to get the name, offset, and length of the file being stored as AssetLocation, but is there a way to get the equivalent information as Unity's API?
    This is a very important aspect of implementing AssetBundle encryption in Streams.
     
  12. orb_9

    orb_9

    Joined:
    Feb 10, 2010
    Posts:
    47
    Hi @JuliusM,
    as @zeprocha already asked, are the Unity APIs for wrapping PAD already available?
    And if not, was is the ETA for this?

    According to Google APK support for Play Console will be ceased August 2021!
    Would be nice to hear about Unitys roadmap concerning AAB/PAD.
     
  13. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    The Unity solution is not available yet.
    2021.2.0b4 should be the first version which will have it. We are planing to have a solution in 2019LTS, 2020LTS and 2021.1 by the end of this month.
    Note that Google Play requirement to publish AAB instead of APK is for new apps only. Updates to existing apps can still be published as APKs https://android-developers.googleblog.com/2020/11/new-android-app-bundle-and-target-api.html
     
    orb_9 and LeonhardP like this.
  14. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    I am not sure what type of Google's implementation you are talking about. Could you provide a link to the documentation?
    Also you wrote AssetBundle. If you use AssetBundles, then you will be able to continue using them. They would simply get packed into asset packs, so you would download the asset pack and get the path to the AssetBundle using Unity's API and then would use Google's APIs to access AssetLocation information inside of the AssetBundle.
     
    LeonhardP likes this.
  15. KrcKung

    KrcKung

    Joined:
    Jul 18, 2017
    Posts:
    56
    New apps as in we already published it? We hav several apps that in Early Access ( Open Testing ), is that still consider new app and need to use .aab when we hit the publish button?
     
  16. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    You should try to verify this with Google. It's their policy.
     
  17. KrcKung

    KrcKung

    Joined:
    Jul 18, 2017
    Posts:
    56
    Thanks for the reply, I will check with Google console help desk directly
     
  18. pp_dd

    pp_dd

    Joined:
    Feb 7, 2019
    Posts:
    52
    "In 2021.2, Unity provides direct support for Android’s new expansion file format, Android App Bundle (AAB) for asset building. Using AAB, developers can meet the Google Asset Delivery requirements to publish any new apps to Google Play."

    Does that mean it's "integrated"?
    Now I'm using 2021.1.15f1 and I installed a plugin/extension for the google asset delivery and it doesn't work at all.
    We're trying to figure it out since nearly two weeks and the only thing it does when you want it to separate your base apk asset is that it creates a totally messed up aab-file that installs an app that doesn't start (black screen then crash -nice)
    apk and obb work(ed) like a charm. This whole aab/google asset delivery destroyed our whole project planning.
    Maybe if its integrated in unity itself it will work...
     
  19. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    2021.2.0b4 was released 6 days ago and it has this feature in it. The documentation on how it works can be found here https://docs.unity3d.com/2021.2/Documentation/Manual/play-asset-delivery.html (note that some scripting API links in this page are currently broken, but you can go to scripting documentation for Unity 2021.2 and find those APIs manually).
    As I have written previously, we are going to bring this feature back to supported Unity versions and it will work the same as it is described in 2021.2 documentation.
     
    Last edited: Jul 21, 2021
  20. pp_dd

    pp_dd

    Joined:
    Feb 7, 2019
    Posts:
    52
    I just tried it out and it works fine in the beta (not like that google asset delivery plugin....)
    Thanks for the information!
     
  21. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
    I have a several questions and feedback after reading through the documentation:
    1. FEEDBACK: It seems to me that the current workflow of defining a custom asset pack is going to impact how the assets is organized in a cross-platform project, as one has to put the assets itself in specific directories which only benefits for one platform. Like, if I want to use the Unity's built-in asset pack generation, instead of putting assets in directories I defined for arbitrary reasons, I'll have to either adapt my asset organization habits just for Android, or I have to find workarounds, like duplicating assets just for the androidpack directory. It would make more sense to implement a definition file solution for asset packs, similar to asmdef files or sprite atlases that holds references to directories or asset. This will also allow us to change the properties of the asset packs right in the Inspector without having to add our own build.gradle files.
    2. FEEDBACK: The documentation currently says that for custom asset packs marked with "install-time", we need to use the Android API (AssetManager) to fetch the contents, which requires writing interop code to call those Java APIs. I think Unity should instead offer a way to get those contents without us having to reinvent the wheels. Google's official plugin would returns the path to the install-time asset packs (in form of APK), offset and length to read the content with a stream.
    3. QUESTION: Since the requirement is putting the "androidpack" directories in the Assets folder, does this have any implication on the asset types that will be include in a custom pack? Would it have the same limitation as AssetBundles that can only include assets importable by Unity? Or are the files in "androidpack" directories not imported by Unity like files in "StreamingAssets"? (The official plugin from Google allows making asset packs arbitrary files and directories with their Editor APIs, even outside of the Unity project directory).
    4. QUESTION: Should the final solution Unity offers ended up not fitting my use case, do I still have the choice to use Google's official plugin, i.e. will Unity's integration conflict with Google's?
     
    JesOb likes this.
  22. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
  23. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    1,066
    Relatedly, how does this handle dependencies? Will the custom asset pack include only assets that are in the .androidpack directory or will it pull in dependencies? In the latter case, could I just put a ScriptableObject with the references I need to define which assets go into the custom asset pack? And if so, how will it handle overlap of dependencies between the packs?
     
  24. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Thank you for a great feedback. I want to start by explaining our philosophy when creating this feature. We wanted to have a solution which would be as simple to use as possible. We also identified that most of affected projects will be set up to use OBB expansion files, so we wanted to create a similar workflow to introduce the least amount of friction when switching from APK + OBB to AAB + asset packs. Finally, we wanted to have a solution that could be brought back to LTS versions where changes are very strictly controlled - generally only the most critical and small changes are allowed. For now this is the implementation of the base functionality. We have some improvement plans for this feature in future Unity versions and your feedback is very helpful.

    Now to address your specific points.
    Re: 1. We don't see custom asset packs as a must-use feature which should be manually used by many projects. We expect that nearly all projects will be able to continue setting up their cross-platform assets in the same way as before. The only reason why the concept of custom asset packs was even introduced right now and brought back to LTS versions, was that with OBB, you can have a single 2GB file, but with asset packs it is not possible. We might not be able to automatically pack everything into asset packs that was previously placed in OBB, so custom asset packs is a solution for those projects.
    Looking into the future, we expect that projects will continue to use asset bundles as the primary way of organising assets in a project. Addressables package is working on a guide / tools, explaining how to set up asset bundles created by Addressables to be automatically delivered using asset packs.
    Finally, we are already planning to allow changing asset pack properties directly in the inspector. It's just that due to time limitations it has not been implemented yet.
    Re: 2. We have not implemented any APIs for this because they would be very specific to a single platform (Android), single distribution platform (Google's Play store) and single delivery type (install-time). Adding to that, we don't think custom install-time delivered asset packs would be very useful in a Unity project. While on-demand custom asset packs can make sense in certain scenarios (where the app wants to download certain platform specific assets only if the user actually needs them), all install-time asset packs will be always downloaded together with the base application, so there is no difference between creating a custom install-time delivered asset pack and allowing Unity to include assets in the automatically created install-time asset pack (or in certain scenarios explained in the documentation, automatically created fast-follow asset pack). You can do that by simply dropping your assets in the streaming assets directory. This is a universal way of organising assets in a cross-platform way and you can access those assets in a universal way as well.
    Re: 3. Files in directories ending with ".androidpack" are not imported just like files in streaming assets directory. There are no specific asset type restrictions. Only files ending with .gradle extension have some limitations. We will take "build.gradle" file, but other files with this extension will be ignored.
    Re: 4. We did not specifically test the compatibility of our solution together with Google's plugin. Both solutions use PlayCore to handle asset packs at runtime. This means if you will try to use Unity's implementation together with Google's plugin, you might run into a conflicting situation where Google's plugin requires different PlayCore version than the one used by Unity's implementation. If only Google's plugin is used without using Unity's solution, then there should be no issues.
    However, if you will find out that your specific use case is not covered by Unity's solution, please let us know what exactly does not work for you, so we would be able to consider that in the future.
     
    Neonlyte and LeonhardP like this.
  25. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Neonlyte likes this.
  26. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Hi @JuliusM. Will next version of Entities package support this PAD feature for dots project out of the box by default?
     
  27. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
    Thank you for the reply. I understand now that there were more considerations than I could foresee.

    If my understanding is correct, the current way is meant to be used with Asset Bundles, that people would put built asset bundles for Android in an androidpack directory. If that is the case, it makes sense.

    For my project, I use CriWare audio middleware instead of the built-in audio system. Their audio file format is proprietary, and because the format relies on file streaming, the file cannot be imported into any kind of Unity asset and, because of this, cannot be bundled into an AssetBundle(unless I remembered it wrong).

    My project is a rhythm game, so the majority of the assets are audio files. Previously, I put all CriWare audio files in the StreamingAssets folder, and copy them out of the OBB into cache on first install. As copying those files would waste extra disk space, I ended up moving my CriWare audio files outside of Assets directory (no .meta file), and build a patch OBB using jobb tool from Android SDK. OBB built using jobb is a FAT disk image and thus the content can be accessed using a file path and thus satisfying the middleware requirement.

    Now with Play Asset Delivery, I would want to embed only a part of the audio audio files at install time and while players going through tutorials, download the audio files for the add-on contents. Because of this, and the fact that file streaming is required, I would need the offset and length of the audio files in the APK (as part of the install-time asset packs) so the middleware can read it, hence I wish a Unity API that can get those info. PlayCore has this information and their Unity plugin mirrors it:
    https://developer.android.com/reference/com/google/android/play/core/assetpacks/AssetLocation
    https://developer.android.com/reference/unity/class/Google/Play/AssetDelivery/AssetLocation

    As for the workflow of defining a package, I do appreciate of having it code-less, comparing to the current integration of iOS On-Demand Resources in Unity, as those asset packs can only be defined using Editor scripts. I think at this point what I want to see is either Android PAD support adding APIs that allows defining asset packs programmatically, or iOS ODR support adding a code-less option that does not requiring putting files in specific directories, so we can have a more or less unified workflow. Because Google's PAD plugin has those APIs, I am more inclined to writing my own asset pack definition files for iOS and Android and build them in an editor script which allows me to prevent making copies of assets and also define different layouts that best utilize the different capabilities of either platforms (iOS ODR: more, smaller packs, Android PAD: larger, fewer packs).
     
  28. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Asset pack is only a publishing format / concept. Custom asset packs don't care what files are added in them and that means they don't manage any dependencies. So only assets placed directly in .androidpack directory will be included in that specific asset pack. To help better understand this - assets in a custom asset pack directory will behave the same as assets placed in streaming assets directory. Unity editor's inspector will not display their properties and you won't be able to assign those assets to components on objects in the scene.
     
  29. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @JuliusM I would like to verify something with u. If I understand correctly, it's still use same API to load if I use asset bundle and also if I use current version of addressable it's still work just like before as long as I dun use custom asset packs. The only thing that PAD feature changed is just the final android build will pack into new asset pack format as install-time, fast-follow and on-demand delivery modes. Am I correct?

    Do u have ETA when it will backport to 2020.3.x LTS? 2020.3.16 LTS?
     
    Last edited: Jul 27, 2021
  30. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    2020.3.15f1 looks like totally about backport this feature and already released
     
  31. UNCLEPOW

    UNCLEPOW

    Joined:
    Apr 26, 2019
    Posts:
    4
    Will it be available for unity2018 LTS?
     
  32. KrcKung

    KrcKung

    Joined:
    Jul 18, 2017
    Posts:
    56
    That was a surprise move. Thanks Unity.

    Tried it yesterday and it able to make an aab build fine and well, but I've encounter exception, something along the line of things are not loaded. This is not happening in OBB version, is there anything else that we need to do?

    I using 2020.3.15f1
     
  33. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Entities package is still in preview, it wasn't tested with PAD feature.
     
  34. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Thank you very much for sharing your use-case. Wrapping some additional APIs from the PlayCore plugin shouldn't be a big undertaking. Knowing the specific use case will help us to consider the best approach for it.
     
  35. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    If you create asset bundles yourself and place them in a StreamingAssets directory, then nothing will change for your project. If you are using Addressables package, then some adaptation will be needed. As I've mentioned in one of the posts, Addressables team is preparing an example how to do that.
    It was included in 2020.3.15f2 (see release notes https://unity3d.com/unity/whats-new/2020.3.15).
     
  36. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @JuliusM I see. One more question. Does AsyncReadManager api supported PAD in 2020.3.15f2?
     
  37. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
  38. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Have you seen this page https://docs.unity3d.com/2020.3/Documentation/Manual/play-asset-delivery.html ? There might be some modifications needed when switching from OBB to Play Asset Delivery. If you followed the manual page and you still encounter an issue, please submit a bug report. Thank you.
     
  39. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    I don't think it was specifically tested, but it should work. If you will encounter issues, please report a bug. Thank you.
     
  40. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Hi @JuliusM. PAD feature doesn't seems working properly in 2020.3.15f2. I get "An error occurred while running bundletool build-apks on your uploaded app bundle. Ensure that your app bundle is valid by running bundletool build-apks locally and try again. Learn more. Error: Usage of 64-bit native libraries is disabled, but App Bundle contains only 64-bit native libraries." when upload my build to google store. Any idea why? I enabled both Export for App Bundle and Split Application Binary according to PAD documentation.
     
  41. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    You should have received a warning in the editor's console which should say
    "Asset packs are included in AAB, bun only ARM64 target architecture and min API level lower than 21 are selected in Player Settings. This AAB will fail to install on the device. Do one of these 3 things to avoid this issue: enable ARMv7 architecture together with ARM64, or set min API level to at least 21, or don't include asset packs in AAB by removing custom asset packs from the project as well as disabling 'split application binary'."
     
  42. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @JuliusM Can u make it support only ARM64 target architecture since one of dots developer tells me only ARM64 target architecture is supported at Android platform? And also if I disable 'split application binary technically it's not using PAD feature anymore and the AAB android build can't exceed 150MB right?
     
  43. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    This issue is on the Android's side. There is nothing we at Unity can do about it. You should be able to set min API level to 21 though (as specified in the warning) without doing anything else and it should solve this issue for you.
    Yes, that is correct.
     
  44. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @JuliusM Do u mean just set min API level to 21 alone can fix only ARM64 target architecture issue? Anyway can u submit this issue to Google so they are aware of it? Or maybe other way round make dots project officially support android ARMv7 architecture too.
     
  45. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    yes, the warning says to do one of these 3 things:
    • enable ARMv7 architecture together with ARM64
    • set min API level to at least 21
    • don't include asset packs in AAB by removing custom asset packs from the project as well as disabling 'split application binary'
     
    optimise likes this.
  46. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @JuliusM Actually even I didn't do any adaptation for Addressables also should be no problem right? It's just I can't customize asset pack delivery mode. Unity by default will build maximum 2GB AAB build that inside has maximum 1GB install-time asset pack then follow by maximum 2 count of 512MB fast-follow asset packs. Something like that? At least for me I dun see any use case that I need to change it.
     
  47. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    I don't know exactly when Addressables loads assets from asset bundles. If your AAB is smaller than 1GB, it might work without any changes (not tested, so no guarantees), but in a general case, there will be some changes needed for asset bundles created by Addressables package to work with Play Asset Delivery.
    The biggest AAB that Unity can produce without using custom asset packs which would still be considered valid by the Play store is about 1.5GB. At most automatically Unity can create 2 valid asset packs - 1GB install-time and 512MB fast-follow delivered asset packs. The only separation that can be done automatically is separating assets in streaming assets directory from everything else. So for example if you have 1.2GB of assets in streaming assets directory and then everything else is 50MB, Unity will create 1.2GB install-time asset pack with streaming assets and 50MB fast-follow asset pack with all additional data. This will not be accepted by the Play store since the largest allowed install-time asset pack size is 1GB. You will see a warning in Unity's editor about this. In this case you would have to move some of the assets from the streaming assets directory into the custom asset pack.
     
  48. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @JuliusM Looks like 2020.3.15f2 is missing Unity.Android.Types. Can u make sure it's available in next 2020.3.16?
     
  49. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Please report a bug.
     
  50. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @JuliusM Alright. Case 1355569.
     
    JuliusM likes this.
Thread Status:
Not open for further replies.