Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Application crashes when everytime asset bundle trying to loaded altough async after windows build.

Discussion in 'Asset Bundles' started by Ozgekocaoglu, Jul 6, 2022.

  1. Ozgekocaoglu

    Ozgekocaoglu

    Joined:
    Feb 13, 2019
    Posts:
    38
    Hello everyone,
    I guess i found a critical bug. But i'm not sure that's why i want to ask you. My code was working at our old games perfectly, and also working 2 days ago. That's why i'm guessing it should be a bug.

    When i trying to load my assets unity waiting and crashing. I tried my old repositories, and they did it too.
    But before 2 days ago, i had not that issue.

    And also, i tried some games made with unity from steam. They were also not working. Is that a windows issue, or unity?


    I will share my loading code.

    Code (CSharp):
    1.   static IEnumerator loadAndInit()
    2.   {
    3.     AssetBundleCreateRequest mainBundleOp = AssetBundle.LoadFromFileAsync(bundlePath + "/" + Game.platformName + "/" + Game.platformName);
    4.     List<AssetBundleCreateRequest> bundleOperations = new List<AssetBundleCreateRequest>();
    5.  
    6.     yield return new WaitWhile(() => !mainBundleOp.isDone);
    7.  
    8.     AssetBundleManifest mainBundleManifest = mainBundleOp.assetBundle.LoadAsset<AssetBundleManifest>("assetbundlemanifest");
    9.  
    10.     foreach(string bundleName in mainBundleManifest.GetAllAssetBundles()) {
    11.       bundleOperations.Add(AssetBundle.LoadFromFileAsync(bundlePath + "/" + Game.platformName + "/" + bundleName));
    12.     }
    13.  
    14.     yield return new WaitWhile(() => bundleOperations.Any(o => !o.isDone));
    15.  
    16.     foreach(var op in bundleOperations) {
    17.       assetBundles.Add(op.assetBundle.name, op.assetBundle);
    18.       switch(op.assetBundle.name) {
    19.         case "core/assets" : {
    20.           coreAssets = op.assetBundle;
    21.         } break;
    22.       }
    23.     }
    24.  
    25.   }
    Application freeze at ''!mainBundleOp.isDone''

    I don't know why. Any idea?
     
    Last edited: Jul 6, 2022
  2. TurgutHakki

    TurgutHakki

    Joined:
    Jun 15, 2017
    Posts:
    33
    Here is a minimal project that reproduces the issue.
     

    Attached Files:

  3. linjianfei

    linjianfei

    Joined:
    Mar 13, 2015
    Posts:
    2

    New

    I also encountered the same problem, and it took me 2 days to solve it.
    Targets (left menu, mid) > Unity Framework > Build Settings > Other Linker Flags (you can search for it) > double click on value + hit plus on button > add "-ld64" > hit Enter > pray to God and be thankful
     
  4. TurgutHakki

    TurgutHakki

    Joined:
    Jun 15, 2017
    Posts:
    33
    Are you using a custom build manager?