Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 luqui · Dec 07, 2010 at 10:44 AM · webplayerbrowsercache

Turn off / invalidate browser cache

We update our game frequently, but our users' browsers have cached old versions. Is there any way to tell the browsers that they should download the .unity3d file anew? It would be okay to turn off browser cache completely since our game is teeny.

Thanks.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Maarten · Dec 07, 2010 at 11:07 AM

They should automaticly download the new one as soon as you upload a new one. This because of the "changed" headers.

However, you can add a random value to the URL. Then it seems that it should load a new page everytime. Use javascript for this.

For example:

var timestamp = (new Date()).getTime(); 
var url = window.location + '?time=' + timestamp;
window.location = url; 
Comment
Add comment · Show 2 · Share
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
avatar image luqui · Dec 07, 2010 at 11:27 AM 0
Share

Clever trick. Strange, maybe there is clock skew or something causing the browser not to detect it. I have only had reports of it not working within a few hours of the upload...

avatar image Waz · Mar 30, 2011 at 04:40 AM 0
Share

By "should", I assume you mean "according to the HTTP protocol", not "Unity follows the HTTP protocol". I'm still looking for some evidence that Unity even makes a request (and so sends or gets any headers) until the Expires time is reached.

avatar image
0

Answer by Thelo · Feb 22, 2011 at 03:40 AM

Adding a query string to the .unity3d file's URL will not always work, for whichever reason - browser caches are really fickle beasts. The way I solved this problem has been to always append the build number to the published .unity3d file, like MyGame436.unity3d. That way, no matter what strange caching algorithm the user's browser uses, it'll redownload the game for sure, since it perceives it as a completely new file.

I'm doing the renaming automatically through a batch file that I run every time I want to publish a new version of the game to the server. It reads the current SVN version of the file through subwcrev (let's say it's 436), then copies MyGame.unity3d as MyGame436.unity3d and changes the .html file to reference MyGame436.unity3d.

Comment
Add comment · Share
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

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.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Web player caching is not happening in only Safari browser. 0 Answers

Is it possible to view a webpage in the webplayer using just c# 1 Answer

Caching of .unity3d file? 1 Answer

Copying unity web player cache 1 Answer

Save/Load game using XML on Browser/Web Player 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges