WWW.assetBundle is null (Unity3d 5.3.4f1)
Hi,
I'm having trouble extracting a scene from an AssetBundle file with the WWW object. Before anyone asks, yes, I did look at http://answers.unity3d.com/questions/820023/wwwassetbundle-is-null-unity3d-455.html , but it wasn't any help. The Asset Bundle is located at https://www.dropbox.com/sh/rgxg06onv1vkt6d/AAAhNecppsitHt6nrDYUwJbga . And, I also know that I misspelled bundle in the folder name.
The Asset Bundle that I'm referring to is "gamescene" file. From within the coroutine I've tried both:
using (WWW www = WWW.LoadFromCacheOrDownload(@"https://www.dropbox.com/sh/rgxg06onv1vkt6d/AAAhNecppsitHt6nrDYUwJbga/gamescene", _levelVersion))
and
using (WWW www = new WWW(@"https://www.dropbox.com/sh/rgxg06onv1vkt6d/AAAhNecppsitHt6nrDYUwJbga/gamescene"))
In both cases, the WWW object some takes the time to download something, and both the progress property and the isDone property mark that it finished downloading. There are no errors in the error property. Yet, the assetBundle property is always null.
I checked the number of bytes (when done without the Caching class) that were downloaded, and I found that size-wise, it only downloads about 10% of the file before it marks that it is done downloading. The reason I said about 10% is not due to rounding, but because the amount downloaded changes from run to run. I've checked the file in question by using the AssetBundle.LoadFromFile(...) method, and loading that scene from the file worked out just fine when I used the AssetBundle class to load it from my hard-drive. Yet, loading it from my hard-drive isn't going to be an option in the final product.
I appreciate any help you guys can give me.
Thanks,
Francisco
Answer by fct 509 · Apr 05, 2016 at 06:42 AM
So, @yathishgk's answer was really close to the correct solution to my problem.
It turns out that there were two problems with my URL.
1- @yathishgk pointed out the first problem. I needed to set "dl=1" in my URL's options.
2- The second issue was with my Dropbox share link. I was using a share link that was for the folder containing the Asset Bundle that I wanted to download, and then I added a slash followed by the file name. There might be a proper way to reference a file that is in a folder that is share linked, but adding "/[filename]" the link's URL isn't the way to go.
What did work was sharing the actual file that I want to download into my game. I then copied the URL for that Share Link into my game and applied the fix for issue 1. I set the "dl" option to "1" instead of "0" inside of the URL.
It took forever to download those 3 megabytes, but they downloaded, and the level loaded just fine. I would also like to thank @yathishgk for their help in this.
Answer by yathishgk · Apr 05, 2016 at 04:57 AM
Even I am facing the same issue ,www.assetBundle is null but i get call back saying the download is complete. But in my case , the link "https://www.dropbox.com/z/xxxxxx/yyyyy?dl=0" had dl=0 , making dl=1 made it possible to download.
The link need to be downloadable asset link.
This solved my problem,Thanks
I also had a "?dl=0" at the end of my link, but when I noticed that it wasn't making any difference, I took it out. I'll have to give your solution a try. Thanks.
So, I can't accept your answer because it wasn't quite right.
That being said, I rewarded you with a point because you were really close, and your answer did lead me to the correct answer.
Your answer
Follow this Question
Related Questions
How do I insert Asset Bundler 0 Answers
keep fixed asset bundle hash values 0 Answers
AssetBundle Manager Doesn't fetch assetBundle on Andriod 0 Answers
Unity 2018.4 - Trying to reload asset from disk that is not stored on disk 1 Answer
AssetBundle (DLC) data load to Android phone at runtime 0 Answers