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 /
This question was closed Jan 17, 2014 at 07:42 PM by robertbu for the following reason:

Duplicate Question

avatar image
0
Question by Balthatczar · Jan 17, 2014 at 05:15 PM · texture2dwwwyieldienumeratorwww.texture

coroutine not downloading data in Update()

I've written a coroutine that fetches a text file with a number of url's in them to images and then goes about downloading those images and puts them in a texture2d array. This works fine if i call on the coroutine in Start(), however what i want the coroutine to do is download the first image in the list (of urls) in Start() and then depending on user interaction i want to download each next image in the list, this user interaction is registered in Update(), but if the coroutine is called upon in Update() nothing happens, no data is transferred at all... Could anyone help me out here? I'd be grateful for it.

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 robertbu · Jan 17, 2014 at 05:15 PM 0
Share

Posting your code would be helpful in sorting this out.

avatar image Balthatczar · Jan 17, 2014 at 06:40 PM 0
Share

Its quite a lot of code, but lots of it unrelated to the problem in this function. All the rest is for creating puzzle tiles out of a single image so i left that all out. Anyway i just tested this as written down below and again it works if called upon in Start(), but not Update().

So i want to call on this coroutine in update, so that i can download a new image in the list based on user interaction.

So here it goes:

  public IEnumerator loadPuzzleTiles_index(int puzzelNR) 
        {
         
           // download list url's puzzle images
             
           yield return puzzleTiles_index_www;
     
           // download image in list
     
           if (puzzleTiles_index_www.isDone)
           {    
             puzzleTiles_indexList = puzzleTiles_index_www.text;
             puzzleTiles_indexArr = puzzleTiles_indexList.Split('\n');
             puzzleTiles_puzzleIndex_www = new WWW[puzzleTiles_indexArr.Length];
             puzzleTiles_puzzleIndex_texture = new Texture2D[1];
     
             puzzleTiles_puzzleIndex_texture[0] = new Texture2D(832,664,TextureFormat.ARGB32,false);
     
             puzzleTiles_puzzleIndex_www[puzzelNR] = new WWW(puzzleTiles_indexArr[puzzelNR]);            
             yield return puzzleTiles_puzzleIndex_www[puzzelNR];
     
             if (puzzleTiles_puzzleIndex_www[puzzelNR].isDone)
             {
            puzzleTiles_puzzleIndex_texture[0]  = puzzleTiles_puzzleIndex_www[puzzelNR].texture;
             }
     
            }
     
          }
avatar image Balthatczar · Jan 17, 2014 at 06:41 PM 0
Share

something went wrong with copying the text, so i did post the function again properly above.

avatar image robertbu · Jan 17, 2014 at 07:43 PM 0
Share

This is a duplicate of your other question:

 http://answers.unity3d.com/questions/619339/downloading-data-via-coroutine-in-update.html

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

18 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

Related Questions

downloading data via coroutine in Update() 0 Answers

Why is this image not downloading properly in WWW class? 0 Answers

Image is not loading into Texture 0 Answers

Only the first half of my coroutine works 1 Answer

Texture loading via www.texture not loading! 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