Search Issue Tracker

By Design

Votes

0

Found in

6000.0.37f1

6000.1.0b5

6000.2.0a2

Issue ID

UUM-96794

Regression

No

Build error on Android when using Patch And Run paired with Play Asset Delivery

-

How to reproduce:
1. Open the attached "IN-88547" project
2. Open the "Game” Scene
3. Open the Build Profiles window
4. Ensure that the default Android Build Profile is selected
5. In the Player Settings window (accessible through the Build Profiles window), and make sure that the Custom Keystore checkbox is disabled (Player > Publishing Settings > Project Keystore)
6. Patch And Run the project to a selected device
7. Observe the Android Logcat window

Expected result: Project builds with no bundle errors and no missing assets
Actual result: Project launches with missing materials and meshes, Android Logcat is displaying bundle errors

Reproducible in: 6000.0.37f1, 6000.1.0b5, 6000.2.0a2
Could not test with: 2022.3.57f1 (Project relies on the Awaitable Class to perform crucial operations, which is only available in unity 6 and onward)

Reproducible on:
VLNQA00566, Samsung Galaxy S8 (SM-G950F), Android 9, CPU: Exynos 9 Octa 8895, GPU: Mali-G71
VLNQA00333, Nokia 7 Plus (Nokia 7 plus), Android 10, CPU: Snapdragon 660, GPU: Adreno (TM) 512
VLNQA00294, OPPO Reno Z (PCDM10), Android 11, CPU: Mediatek MT6779 Helio P90, GPU: PowerVR Rogue GM9446
VLNQA00519, Google Pixel 4 (Pixel 4), Android 12, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640

  1. Resolution Note:

    Closing as by design. The player errors and missing assets in the reproduction project that can be fixed by changing Addressables settings and modifying the user's code. After doing so, rebuild Addressables using the Play Asset Delivery build script. The game should load as expected with no errors. Note that when the reproduction project is first opened, the build location for the player is set to the project root folder and should be set to a different folder.

    1. NullReferenceExceptions

    Each Addressable group has its own Asset Provider and Asset Bundle Provider setting. The Asset Provider loads assets from their AssetBundles and the Asset Bundle Provider loads AssetBundles. The provider type for all groups can be set in Addressables Asset Settings > Catalog. The default provider types are Assets from Bundles Provider (Asset Provider) and Asset Bundle Provider.

    In the project the Asset Provider and Asset Bundle Provider are set to the Play Asset Delivery Provider. The Play Asset Delivery Provider is a custom bundle provider (the class inherits from AssetBundleProvider). Set Addressables Asset Settings > Catalog > Asset Provider to the default Assets from Bundles Provider. This will address the null reference exceptions that occur when loading assets in the player.

    2. WaitForCompletion errors from localization assets

    The WaitForCompletion errors ("Play Asset Delivery provider does not support synchronous Addressables loading") are caused by loading localization assets with the Play Asset delivery provider. The localization package uses WaitForCompletion to initialize and run operations. Set Addressables Asset Settings > Catalog > Asset Bundle Provider to Asset Bundle Provider so that the Play Asset Delivery provider is not used for the localization groups. This is safe to do since the Play Asset Delivery build script will set the Play Asset Delivery Provider for Play Asset Delivery groups.

    3. WaitForCompletion errors from shared bundles

    In addition to the bundles created from your AddressableAssetGroups, a build can produce specialized bundles called shared AssetBundles. These are the unitybuiltinassets AssetBundle and the MonoScript AssetBundle. Shared AssetBundles derive their build options from the default AddressableAssetGroup. In the project the Play Asset Delivery Assets group is set as the default Addressable group. One way to fix this is to create a new Addressable group that doesn't use Play Asset Delivery bundle provider and set it as the default group. To do this right click on the group in the Addressable Groups window and select Set as Default.
    https://docs.unity3d.com/Packages/com.unity.addressables@2.4/manual/build-shared-assetbundles.html
    https://docs.unity3d.com/Packages/com.unity.addressables@2.4/manual/GroupsWindow.html#group-context-menu

    4. Invalid operation handle exception

    There are user scripts (Menu.cs and LanguageSelector.cs) that try to load localization assets at the same time on Start(). The Addressables system initializes itself at runtime the first time you load an Addressable or make another call to an Addressable API. So both scripts will trigger initialization at the same time, resulting in an invalid operation handle exception. One way to fix this is to move the Start() code in LanguageSelector.cs into a public method that is called by Menu.cs.
    https://docs.unity3d.com/Packages/com.unity.addressables@2.4/manual/InitializeAsync.html

    5. Missing Assets

    The missing assets are being loaded correctly, but in the user is calling Addressables.Release in AddressableLoader.cs line 100, which immediately unloads the assets. When Release is commented out, the assets will be kept loaded in memory.
    https://docs.unity3d.com/Packages/com.unity.addressables@2.4/manual/UnloadingAddressableAssets.html

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.