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
1
Question by Eugenio · Mar 25, 2013 at 03:33 PM · androidcoroutinewwwunity4streamingassets

In Unity 4.1 www.isDone doesn't seem to work in Android. Any suggestion?

Hi everyone !!! I'm trying to make a load class for the StramingAssets and I wrote this stuff:

 protected void Awake() {
     // let's add the / if not defined in the additional path if it is defined.
     if (additionalPath != null && additionalPath.Length != 0) {
         if (additionalPath[0] != '\\' && additionalPath[0] != '/') {
             additionalPath = "/" + additionalPath;
         }
         if (additionalPath[additionalPath.Length - 1] != '\\' && additionalPath[additionalPath.Length - 1] != '/') {
             additionalPath += "/";
         }
     }
     // get the path to the Streaming Assets folder based on the used platform.
     resourcePath = System.IO.Path.Combine(Application.streamingAssetsPath + additionalPath, resourceFilename + "." + resourceFileExtension);
     // load the resource file.
     if (resourcePath.Contains("://")) {
         StartCoroutine(LoadCoroutine(resourcePath, www => { ProcessLoadedResource(www); }));
     }
     else {
         // load with System IO classes
     }
 }
 
 private IEnumerator LoadCoroutine(string path, Action<WWW> complete) {
     WWW www = new WWW(path);
     // load the XML and grab contents.
     while (!www.isDone) {
         yield return www;
     }
     complete(www);
 }
 
 private void ProcessLoadedResource(WWW www){
     ManageWwwLoadingResult(www);
     // clean up WWW.
     www.Dispose();
     www = null;
 }

Windows an Mac OS X works well because I use another method to load the resources without touching the WWW class.

iOS works with both iPad and iPhone.

Android is not going to work. It seems (seeing the logs in Eclipse), that the while(!isDone) is not working because the call for the use of the loaded resources came before the call to the ProcessLoadedResource(WWW) function. I want to add that the call for the resource is performed by another component in the Start() function.

I really don't know what to do to fix this problem.

Any idea?

Thanks :-)

Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

10 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

Related Questions

I can't figure out how to use www to copy a file / very confused about porting to android... 0 Answers

Problem using StreamingAssets on Android build 0 Answers

Streaming Assets android 0 Answers

how do you correctly copy a jpg file from streaming assets folder using www? 1 Answer

How to read xml file on Android using www and StreamingAssets? 2 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