Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ajketan · Aug 05, 2014 at 08:43 AM · assetbundleloadlevelasyncwww class

Asset bundle not getting loaded from cache

In my case instead of simple assetBundles I am dealing with Streamed Scene Asset Bundle.

In my Splash Screen Scene (Before getting in to the actual game) I download the asset bundle using www.loadfromcacheordownload() ....it works fine.

     IEnumerator DownloadAssetBundle(string abname, string url, int version)
     {
         www = WWW.LoadFromCacheOrDownload(url, version);
         
         while (!www.isDone && www.error == null)
         {
             Debug.Log("downloaded " + (www.progress * 100).ToString() + "%..." + "Asset Name : "+abname);
             yield return null;
         }
         
         if ((www.error != null && !www.isDone))
         {
             throw new System.Exception("WWW download had an error:" + www.error);
         }
         else
         {
             yield return www;
         }
     }

Now when my game starts... I ask the user to select from available levels (that were downloaded as asset bundles)....

When I load one of these level ... I again use www.loadfromcacheordownload() .... so this time asset bundle is supposed to be loaded from cache ...

     IEnumerator CreateLevelStringAndLoadLevel(int levelNumber)
     {
         string levelToLoad = "Level_" + levelNumber;
         
         // We have an array of assetbundle info in our jChapterNode, so "chapterNumber - 1" refers to the track number of corresponding assetbundle
         
         string url = GetChapterURL(levelNumber);
         int version = GetChapterVersion(levelNumber);
         
         www = WWW.LoadFromCacheOrDownload(url, version);        // should be loading from cache
         
         //yield return WaitForLoading();
         if(www.error != null)
             throw new UnityException("Error while downloading AssetBundle : " + www.error);
         
         if (Caching.IsVersionCached(url, version))
             bundle = www.assetBundle;
         
         async =  Application.LoadLevelAsync(levelToLoad);                // Level that is to loaded has name Level_1, Level_2....so on...!!    
         
         while (!async.isDone)
         {
             uiSlider.value = async.progress; // Show the progress bar increasing with 'async.progress'
             yield return null;
         }
     }

but my game crashes at this point (on devices) ....and while play testing in editor ... the editor crashes and I am not getting any other leads. No error no exception....nothing...!!

Where can the problem be ... Please help...!!

Cheers....

Thanks in Advance...!!

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ajketan · Aug 06, 2014 at 07:42 AM 0
Share

anything ..... anyone...?

avatar image ajketan · Aug 22, 2014 at 06:48 AM 0
Share

Something more that I found.... When I try to debug using $$anonymous$$onodevelop's Breakpoints...Unity still crashes but I get these errors

alt text

The funny bits are First ....This thing was working like a cheese cake and one not-so-fine day it just stopped... Second.... that using the exact same code and exact same Streamed Scene AssetBundle in a fresh (new) project things work good.... without any issue.

Can I get any lead on this where could the problem be....!! Please please please help.... Its been more than 2-3 weeks for me getting stuck in this...

screen shot 2014-08-18 at 6.11.16 pm.png (57.8 kB)
avatar image ajketan · Aug 22, 2014 at 03:48 PM 0
Share

Ok now ... it is not getting crashed ... but the following error is co$$anonymous$$g...

Level 'Chapter_1' (-1) couldn't be loaded because it has not been added to the build settings. To add a level to the build settings use the menu File->Build Settings...

avatar image ajketan · Aug 22, 2014 at 06:46 PM 0
Share

@whydoidoit .... i have gone through many of your tutorials and posts... I am sure you have some thing that may help he here...Please ... !!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ajketan · Dec 01, 2014 at 08:09 AM

Eventually I found out that there was nothing wrong with the code that I used.... It was the assetbundle that was causing issues for me.... apparently there was a GameObject that was having a singleton class attached to it...and this GameObject was not getting used. So I removed it and everything was normal.

I am yet to figure out what is the relation between that GameObject being in my scene and my AssetBundle not getting loaded. Please if anyone is aware of that .... kindly enlighten me...!!

Cheers

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to import the object from server to unity 2 Answers

Saving an AssetBundle decompressed 0 Answers

www doesn't work on ios Unity5.3.4 0 Answers

BuildPipeline.BuildPlayer - Download scenes without adding them to build menu 1 Answer

Can I download a single asset file through WWW class instead of the assetbundle? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges