Search Issue Tracker

Won't Fix

Votes

13

Found in

2021.3.31f1

2022.3.10f1

2023.1.16f1

2023.2.0b12

2023.3.0a8

Issue ID

UUM-53658

Regression

No

[Android] Split-binary AAB file fails to load data from the Streaming Assets Pack when a small Scene is selected as the starting Scene

--

-

Reproduction steps:
1. Open the attached project "ReproProj" with Android Platform
2. In Edit > Project Settings > Player Settings > Other Settings select Minimum API Level “Android 7.0 ‘Naugat’ (API level 24)”
3. In File > Build Settings window select Build App Bundle (Google Play)
4. In File > Build Settings window select Development Build
5. Make sure that Scenes/start scene, Scenes/main scene, and Scenes/bloat scene are selected in the Build Settings window
6. Build and Run
7. In the Player observe that the video is playing
8. Press the Button with the text “Not Streaming”

Expected result: The video is playing and at the start of it you can see the text Mark Of Zorro
Actual result: No video is playing

Reproducible with: 2021.3.31f1, 2022.3.10f1, 2023.1.16f1, 2023.2.0b12, 2023.3.0a8

Reproducible on:
VLNQA00325, Samsung Galaxy Note10 (SM-N970F), Android 12, CPU: Exynos 9 (9825), GPU: Mali-G76
VLNQA00318, Oneplus OnePlus 7 Pro (GM1913), Android 11, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640
VLNQA00231, Huawei HUAWEI Mate 20 Pro (LYA-L29), Android 9, CPU: HiSilicon Kirin 980, GPU: Mali-G76

Not reproducible on:
VLNQA00231, Samsung Galaxy A5(2017) (SM-A520F), Android 8.0.0, CPU: Exynos 7 Octa 7880, GPU: Mali-T830

Testing environment: Windows 10 Enterprise 21H2
Not reproducible on: No other environment tested

Note:
- If the first scene is large, the app will correctly access the Streaming Assets Pack, but this will prevent the app from being submitted to Google Play. It can be tested by building and running the Player with the "bloat scene" enabled, and the "start scene" disabled

  1. Resolution Note:

    Hello.
    Our QA verified that the code below works in the Unity Editor 2021.3.31f1, 2022.3.10f1, 2023.1.17f1. If that doesn't work, try a clean build.
    Thank you. :D

    --------------------------------------------------------------------------------------------------------------
    This issue occurred because the UnityStreamingAssetPack designated as “fast-follow” did not complete downloading.

    First, as instructed in this link(https://docs.unity.cn/2023.1/Documentation/Manual/android-asset-packs-in-unity.html), it has size limitations(https://developer.android.com/guide/playcore/asset-delivery#download-size-limits). So you should keep this in mind.

    “ If the additional assets take more than 1GB of storage, Unity adds Streaming Assets into one asset pack called UnityStreamingAssetPack and adds all other assets into the UnityDataAssetPack asset pack. Uniy assigns the install-time delivery mode to the larger asset pack and assigns the fast-follow delivery mode to the smaller one.”

    As mentioned in the sentences above, when I checked the generated .aab file, I could see that “install-time” was assigned to UnityDataAssetPack(around 1.13GB) and “fast-follow” was assigned to UnityStreamingAssetsPack(around 888MB).

    And as you can see here(https://docs.unity.cn/2023.1/Documentation/Manual/android-asset-packs-manage.html), “Google Play automatically starts to download fast-follow asset packs after it installs the application. However, it’s possible that not all fast-follow asset packs are available on the first time the application launches.” We cannot handle this. It’s up to Google.

    However, As guided in the link, you can solve the issue by adding the code like below.

    ——————————————
    private static int _mRemainingsToDownload = 0;

    private Action<AndroidAssetPackInfo> DownloadAssetPackAsyncCallback = delegate(AndroidAssetPackInfo info)
    {
    Debug.Log($"DownloadAssetPackAsyncCallback() name = [{info.name}], bytesDownloaded/size = {info.bytesDownloaded}/{info.size}, transferProgress = {info.transferProgress}, status = {info.status}, error = {info.error}");
    if (info.status == AndroidAssetPackStatus.Completed)
    {
    _mRemainingsToDownload--;

    if (_mRemainingsToDownload == 0)
    SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
    };

    private IEnumerator Start()
    {
    Debug.Log($"Start() coreUnityAssetPacksDownloaded = {AndroidAssetPacks.coreUnityAssetPacksDownloaded}, Length = {AndroidAssetPacks.GetCoreUnityAssetPackNames().Length}");
    if (!AndroidAssetPacks.coreUnityAssetPacksDownloaded)
    {
    string[] coreUnityAssetPackNames = AndroidAssetPacks.GetCoreUnityAssetPackNames();
    _mRemainingsToDownload = coreUnityAssetPackNames.Length;
    AndroidAssetPacks.DownloadAssetPackAsync(coreUnityAssetPackNames, DownloadAssetPackAsyncCallback);
    }
    yield return null;
    }

    ——————————————

    I hope this is useful to you. Thank you.*

Comments (6)

  1. MotionBrain

    Apr 22, 2024 21:15

    I have the problem with Unity 2022.3.25f1

    I do have two scenes

    StartScene ~ 50 mb
    MainScene ~1.5gb

    The Vuforia 10.22.5 data.xml & data.dat wont be loaded correctly.
    Therefore Vuforia does not work.

    Vuforia does work, if the app size is smaller than 150MB and aab does not trigger the special instalation ...

    Please help!

  2. sevenedusrrb

    Mar 14, 2024 13:39

    Please try to add the conditional statement:

    if (AndroidAssetPacks.coreUnityAssetPacksDownloaded == false)
    {
    // download assets
    }
    else
    {
    // load the scene
    // SceneManager.LoadSceneAsync(1);
    }

  3. luvcraft

    Mar 08, 2024 22:30

    Also fixed in 2021.3.36

  4. luvcraft

    Mar 08, 2024 20:51

    UPDATE:
    Updating this project to Unity 2022.3.19f1 fixed this bug!

    coreUnityAssetPacksDownloaded now correctly returns false, and the provided code snippet correctly loads the UnityStreamingAssetsPack.

    I will try this with other Unity versions as well.

  5. luvcraft

    Mar 08, 2024 20:12

    I've been very busy and have just gotten around to trying this solution. It does not work. On launch, the following is logged to the console:

    AndroidPlayer "Google_Pixel 5@ADBFDD4005BG:0" Start() coreUnityAssetPacksDownloaded = True, Length = 0
    <Start>d__2:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

    and since it thinks that the coreUnityAssetPacksDownloaded = True, and there are no packs to download, it does not proceed to download anything and just hangs at that first scene after finishing Start().

    Please advise.

  6. spektrayusufdemir

    Oct 25, 2023 17:45

    We are facing same issue

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.