I use this WWW script: Unity - Scripting API: WWW
It’s working. But when I change the code to this:
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
public string url = "http://images.earthcam.com/ec_metros/ourcams/fridays.jpg";
void Start () {
StartCoroutine (Co ());
}
IEnumerator Co() {
// *** THIS IS THE NEW LINE ***
url = "http://NEW URL";
WWW www = new WWW(url);
yield return www;
Renderer renderer = GetComponent<Renderer>();
renderer.material.mainTexture = www.texture;
}
}
It’s not working. Why?
I printed the new URL in the console and tested it. The new url works.
So, the new url change in the coroutine is not working.