- Home /
Caching of .unity3d file?
I have noticed when the .unity3d file is downloaded from our web page, it has the request headers
Cache-Control: no-cache
Pragma: no-cache
which is causing cache misses where they would potentially hit (and running up a large bill with our CDN).
Is there a way to make the Unity web player support caching when downloading this .unity3d file? For example as an option to the unityObject.embedUnity call?
Answer by Graham-Dunnett · Jan 16, 2013 at 03:47 PM
In a web browser all requests for data are handled by the web browser. So your unity3d file is fetched for the web player using the browser. You can see this in browsers that have some kind of activity or network viewer. If you want the unity3d file to be cached by the browser, set it's headers accordingly. The unity3d files fetched from the unity3d.com site have:
Cache-Control:max-age=604800
Maybe whoever set your site up has turned caching off for a reason?
Sorry, maybe I should have said, those are the request headers sent. The content is delivered via a CDN. We use unique URLs (with no query string) for each new version.
As the request headers specify no-cache, the server should always send the full file. The question is really why this is happening. The file is about 10$$anonymous$$B.
So, after looking at my Chrome settings and re-enabling the cache when the Developers Tools window is open, I now see as a header sent Cache-Control: max-age=0 and no Pragma header. I suppose that is an improvement, but it still inhibits caching.
Actually now I cannot find a reference to the web browser unityObject interface, it redirects to UnityObject2.