Home > other >  [Unity problem] AssetBundle resource loading error problem
[Unity problem] AssetBundle resource loading error problem

Time:09-30


We now download ab is the logical process of resources, asynchronous or synchronous written to a local, then download for the first time using AssetBundle. LoadFromMemoryAsync (bytes), the second use of the local LoadFromFileAsync to load the ab bag, asynchronous or synchronous write local write local make mistakes, vivo x9 is easy to collapse, now have UnityWebReq, feeling from the CDN download resources is a problem with the binary data, written to a local, by AssetBundle LoadFromFile read out ab resources complains (there is an error log), we do not really understand the specific issues hope bosses give solutions, very grateful

CodePudding user response:

UnityWebRequest load AB package, reference API specification, determine the download AB right,
 private IEnumerator Load () 
{
The string url="";//this is AssetBundle resource path, but for the local, can also be a server
UnityWebRequest request=UnityWebRequest. GetAssetBundle (url);
Yield return request. The send ();
AssetBundle ab=DownloadHandlerAssetBundle. GetContent (request);

GameObject ao=ab. LoadAsset Man1 (" ");
Instantiate (ao);
}

CodePudding user response:

You this is wrapped ab saved to the local load resources later?
I used to load resources also quoted by WWW.LoadFromCacheOrDownload this mistake, is the same frames triggered the loading method of the same file, then it is good to use WWW load directly, reading the newspaper I wrong estimates from the local cache file decompression of the loading process, here is another request to decompression process in IO conflict,
Left with the WWW, and now I'm planning to use your method, realize LoadFromCacheOrDownload similar function, and then to load with LoadFromFileAsync, look at your problem, I can only give up on asynchronous loading.
I will try use loadfromfile synchronous loading to see an error,
Maybe upstairs brother method is positive solutions
  • Related