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 MichaelTaylor3d · Jul 17, 2012 at 04:35 PM · asset bundlesstream

Streamed Asset Bundle Help

Im trying to Load a set of streamed asset bundles i created at run time. However something seems to be missing from my code. Could someone please take a look?

 //public void LoadLevelAdditively ()
  void Start()
  {
  //optimize this later as a for loop or whatever
  StreamedAssetBundlePathsList.Add(url + "Streamed-LOD0.unity3d");
  StreamedAssetBundlePathsList.Add(url + "Streamed-LOD1.unity3d");
  StreamedAssetBundlePathsList.Add(url + "Streamed-LOD2.unity3d");
  StreamedAssetBundlePathsList.Add(url + "Streamed-LOD3.unity3d");
  StreamedAssetBundlePathsList.Add(url + "Streamed-LOD4.unity3d");
  StreamedAssetBundlePathsList.Add(url + "Streamed-LOD5.unity3d");
  
  //Loop through the list and download the compressed asset bundles from the web server,
  //If the asset bundle was already downloaded and cached for any reason UNITY will skip this process
  
  foreach(string StreamedAssetBundle in StreamedAssetBundlePathsList)
  {
  var AssetBundleDownload = WWW.LoadFromCacheOrDownload(StreamedAssetBundle,5);
  
  //verify download
  if(AssetBundleDownload.error != null)
  {
   Debug.LogError (AssetBundleDownload.error);
   return;
  }
  
  //Load the current Asset Bundle into memory
  var bundle = AssetBundleDownload.assetBundle.name;
  
  //Additively Load the level into the scene
  Application.LoadLevelAdditive("CityLOD" + StreamedAssetBundlePathsList.IndexOf(StreamedAssetBundle)); //<--LOD(int) refers to the scene name
  
  }
  
  
  
  
  }
Comment
Add comment · Show 12
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 flamy · Jul 17, 2012 at 04:50 PM 1
Share

hmm wat is the problem?? u didnt mention it?!

avatar image MichaelTaylor3d · Jul 17, 2012 at 05:04 PM 0
Share

The streamed asset bundles wont load into the scene, it just freezes and then crashes the web player

avatar image rutter · Jul 17, 2012 at 05:46 PM 0
Share

I would try to reproduce the problem with the simplest setup you can manage -- think of empty scenes, scenes with only one cube object, cutting out your looped WWW loads, loading via the file:// protocol from your developer machine, and so on. None of these suggestions will necessarily fix the problem, but they might help you narrow down what exactly is (or isn't) going awry.

avatar image Julien-Lynge · Jul 17, 2012 at 07:31 PM 1
Share

I don't see where you're yielding on the download. You set up a WWW, but then try to access it immediately after - WWW calls don't return immediately, or block the execution until they return - they run asynchronously. Try running a coroutine and yielding the download.

avatar image MichaelTaylor3d · Jul 17, 2012 at 07:52 PM 0
Share

Julien, That makes since, Im curious on how to yield until after the download is complete,

So do I put the actual WWW call in a coroutine and return to the foreach loop after its finished?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Julien-Lynge · Jul 24, 2012 at 08:37 PM

Answer: See the comment string. In a nutshell, it's necessary to yield AssetBundle downloads before trying to load them.

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

8 People are following this question.

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

How to make a gameobject into a stream? 1 Answer

TCPClient and SslStreams in WebPlayer (C#) 0 Answers

Help Audio streaming from microphone to online url. Uploading only 4kb chunk at a time. 1 Answer

AssetBundles, memory, and loading 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