Search Unity

Question Loading larger mesh from asset bundle takes minutes

Discussion in 'Asset Bundles' started by Qleenie, Feb 23, 2022.

  1. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Hi,

    I am trying to load a larger mesh (around 65K) with around 350 blend shapes from an asset bundle.
    This takes multiple minutes, and I don't understand why this is the case. What's even more strange, if I measure the time around the load function, the log tells me it takes less then 2 seconds. Here is the code for loading the asset and measuring the time:

    Code (CSharp):
    1.         float time = Time.realtimeSinceStartup;
    2.         var myLoadedAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "assets" , hairProperties.prefabName));
    3.         if (myLoadedAssetBundle == null)
    4.         {
    5.             Debug.LogError("Failed to load AssetBundle!");
    6.             return null;
    7.         }
    8.  
    9.         GameObject prefab = myLoadedAssetBundle.LoadAsset<GameObject>(hairProperties.prefabName);
    10.        
    11.  
    12.         myLoadedAssetBundle.Unload(false);
    13.         Debug.Log("Time for loading hair asset: " + (Time.realtimeSinceStartup - time));
     
  2. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    As a small update: The issue only happens in Editor, so probably some sort of Unity bug I guess.