WWW only downloading once?

Hey guys,

I’ve got a script that gets a value from the given URL and displays it. It works fine in Editor and Runtime so far, but my problem is that I have to build it as Windows Universal App (Windows Store App).

When I debug the build in Visual Studio, it starts properly and loads the data from the server. After five seconds it restarts the scene and should download it again to check if the value has changed. And there’s the problem.

After the first download it doesn’t work anymore. It’s refreshing every 5 seconds but when I change the value on the server it doesn’t appear on the screen. It can’t be a server problem because it’s working for all other platforms, so there’s propably something wrong with the Universal App. I don’t know if it’s just a problem showing the text. “Internet(Client)” capability is enabled.

           void Start ()
                  text = GameObject.Find("Text").GetComponent<Text>();
              IEnumerator Download()
                  //Get the value from the server
                  download = new WWW (webURL + publicCode + "/pipe/" + attribute);
                  yield return download;
                  //Write it in the UI element
                  text.text = download.text;
                  yield return new WaitForSeconds(5);

Thanks in advance


Well, if you “download” a file / resources from the internet and it doesn’t change, the problem is most likely that it has been cached somewhere on the client. The behavioud highly depends on how the WWW class is implemented on the target platform. Such problems usually arise in WebGL builds as browsers usually always try to cache your content.

Caching should actually be disabled on your server. See this SO question for how to disabple caching on an apache server.

Another common clientside-workaround is to simply append a random or increasing integer number at the end of your URL, usually as fragment or additional URL parameter. This way the URL is a different one each time you request your file so caching shouldn’t be a problem. Though this is not a nice solution as the client would create a lot of different cached versions for each variant. It’s in general better to disable caching,

hmmm. Try checking for download.isDone from the API before sending your value. Your script is pry still not waiting for the download to finish.