0

In my code I have several snippets like the one below with different purpose. In the start() method I added the following code "AssetBundle.UnloadAllAssetBundles(false);". When I run the application sometimes it runs without error and sometimes it runs with the following error "can't be loaded because another AssetBundle with the same files is already loaded.".

        using (UnityWebRequest webRequest = UnityWebRequestAssetBundle.GetAssetBundle(url))
        {
            yield return webRequest.SendWebRequest();

            if (webRequest.result != UnityWebRequest.Result.Success)
            {
                Debug.Log(webRequest.error);
            }
            else
            {
                AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(webRequest);

                GameManager.Instance.bundleListCues = new List<Sprite>(bundle.LoadAllAssets<Sprite>());
                if (bundle == null)
                {
                    Debug.LogError("Failed to download AssetBundle!");
                    yield break;
                }
                bundle.Unload(false);
            }
        }

  • `can't be loaded because another AssetBundle with the same files is already loaded` .. sounds pretty self-explanatory to me apparently you are trying to load the same bundle file twice .. sometimes it works but sometimes it conflicts -> sounds like a timing/race condition – derHugo Jan 14 '22 at 11:45
  • @derHugo As well? Would it be like execution order? – Joel Oliveira Jan 14 '22 at 11:53

0 Answers0