• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DigitalGrunt · Apr 27, 2015 at 07:22 PM · webplayercache

Why aren't .unity3d files being cached when viewed in the webplayer?

When downloading the unity model in a web page, I noticed that large files (for example 6.9MB) are not being cached even though the web server and browser are configured to do so. When I checked the request I noticed there was no "If-Modified-Since" header and therefore, no subsequent "304 Not Modified" response from the server. I did see however the .unity3d file stored in the browsers cache folder:

...\AppData\Local\Microsoft\Windows\INetCache\sample.unity3d

Why, if the file is stored in the cache, would the webplayer continually contact the server to download the file again?

Response Header:

 Response    HTTP/1.1 200 OK
 Content-Type    application/vnd.unity
 Last-Modified    Wed, 25 Mar 2015 13:34:35 GMT
 Accept-Ranges    bytes
 ETag    "713eff6e067d01:0"
 Server    Microsoft-IIS/8.0
 X-Powered-By    ASP.NET
 X-UA-Compatible    IE=EmulateIE7
 Date    Mon, 27 Apr 2015 15:50:42 GMT
 Content-Length    7237995

If I try the request using a simple jQuery ajax call with the appropriate request headers, the server responds correctly:

 $.ajax( { 
     url : '/path/sample.unity3d', 
     async : false, 
     type : 'get', 
     headers : { 'If-Modified-Since' : 'Wed, 25 Mar 2015 13:34:35 GMT' }
 } ).getAllResponseHeaders();

After the JavaScript is executed, I get this response from the server:

 Response    HTTP/1.1 304 Not Modified
 Accept-Ranges    bytes
 ETag    "713eff6e067d01:0"
 Server    Microsoft-IIS/8.0
 X-Powered-By    ASP.NET
 X-UA-Compatible    IE=EmulateIE7
 Date    Mon, 27 Apr 2015 15:57:58 GMT

Which is what I would expect to happen when the webplayer loads the file.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

How would you tell if the webplayer got loaded from web or cache? 0 Answers

Updating txt from an url (webplayer) 0 Answers

Unauthorized use of Caching API in webplayer 0 Answers

Web player cache 1 Answer

How does webplayer cache works? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges