- Home /
Waiting for data to load .. I'd need two enumerators! How Can I do?
Hi! Of course I am a noob. Following various tutorials and answers, I am trying to change a sprite with an external URL. Now the problem is that I have an "ImageManager" script that gets info from another script:
public string Test;
public GameManager gameManager;
public Image img;
// Use this for initialization
IEnumerator Start () {
yield return new WaitForSeconds(5);
Test = gameManager.URL;
Debug.Log("Valore Stringa: " + Test);
}
Five seconds are a just a test, but I need some times to get that URL from the other script and store in the "Test" string. If I do in a normal void start, I am getting an empty string.
Now ... here on answers (https://answers.unity.com/questions/1175862/loading-a-sprite-from-url-c.html) I found how to load an image from URL (in my case it's stored in Test string) ... but It also require an IEnumerator to wait for the image is loaded.
How can I set my script to let it grab URL first and IMAGE then?
Thanks for replying!
Your answer
![](https://koobas.hobune.stream/wayback/20220612164235im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
WWW Request runs in Editor but not in Webplayer 1 Answer
WebGL - too much recursion browser error! 1 Answer
Crashing on www method 0 Answers
Loading images from cross-domain 1 Answer
Asset Bundle Download Crashing 0 Answers