- Home /
Question by
SamKeane · Nov 22, 2013 at 04:24 PM ·
javascriptcoroutinewww class
WWW not updating variables in javascript
This class is meant to retrieve some text and change the displayed text to it. It works in C#, this is a conversion so I think I might have missed something in translation.
function Start () {
sometext = "Downloading ...";
urlstring = "http://dl.dropbox.com/u/2238318/DownloadTest.txt";
getText(urlstring);
Debug.Log("Downloaded Text was " + sometext);
}
function Update () {
theText.text = sometext;
}
function getText (url : String)
{
StartCoroutine (download(url));
Debug.Log("Downloaded Text was " + sometext + " after coroutine");
}
function download (atlasName : String)
{
var url : WWW = new WWW (atlasName);
yield url;
sometext = url.text;
}
Comment