- Home /
How to refresh my webplayer at runtime
Hi there
I have been stuck on this for quite some time now...
How do I force a web page to download my webplayer instead of using the one that is already in the cache? I don't mean downloading assets into my web player, I mean actually download a fresh copy of the webplayer itself...
Each time I upload an updated version of my web player I have to access it from a different subdomain or give it a new name so the new version will download. How can I get the plugin to go: "Ahhh, there is an updated version on the web, let me download THAT one" instead of "Meh, I already have a file called webplayer.unity3d in the cache, I'll just use that"?
Thanks in advance
Answer by almo · Jul 27, 2011 at 03:21 PM
You could put this in your page:
< META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE" >
Answer by Graham-Dunnett · Jul 27, 2011 at 03:22 PM
The web browser and web server need to agree to not cache the unity3d file. I guess http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html is the detailed technical information you need. But given that the unity3d file is named in your html, can you just prepend some version number onto the unity3d file and make sure the web page fetches the "correct" latest file? So you html loads mygame0001.unity3d instead of mygame.unity3d. (This just moves the caching problem from the unity3d file to the html file.)
Answer by mMrDude · Jul 28, 2011 at 07:59 AM
@ALMO If I say no-cache, will that mean that nothing on that page gets saved to the cache but stuff I download from within my web player WILL or will also not get saved? I need to save lots of content to the user's hard drive so I will most probably be in permanent conflict with other people trying to 'share' the 50Mb.
@Graham Your method seems the most simple and surefire way to get the latest version downloaded but this still means changing the name each time. My question is this: Out of the 500,000+ Unity devs out there, surely some of them must have made an app for the web player and at some point released an update to that app so how did THEY get the new version to run?
Is there absolutely no way at all from within Unity to se it up that the latest version loads (wether via meta, header, whatever)? Is the absolutely only way to ensure a player plays the latest version of your app to change the name? Is this how the other 500,000 devs do it or is there a 'better' or 'official' or 'right' way to do this?
For example, I have been reading a lot about version numbers lately. The whole WWW.LoadFromCacheOrDownload(filename,version) is quite clear in what it does... but something that I have not seen mention anywhere, nor seen in the examples posted on this site or elsewhere, even the docs, actually show me how to SET the version number for an asset I upload...
So I can download assets by version number but I can't set the version number ? Is there some mystical text that the Unity Plugin does that checks for version number of the file it is supposed to load and then downloads it if needs be or is it down to the devs to implement this functionality?
Again, it boils down to: "What is the best/right/official way of getting the latest version of your app to run from a website?"
Did you have any more luck with this m$$anonymous$$rDude?
Is the best solution to add the version number to the .unity file and update the webpage to point to the latest version?
Your answer
Follow this Question
Related Questions
Unity Engine not updating to the latest version 1 Answer
Webplayer Engine Version 7 Answers
Unity Web Player Failed To Download Data File 1 Answer
Download assetbundles with Webapp 0 Answers
Web player update 0 Answers