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
1
Question by BTamas · Aug 07, 2012 at 11:23 AM · androidiosassetbundlewwwcache

how to delete specific files from cache?

Hello

We use WWW.LoadFromCacheOrDownload() to download and cache assetbundles in our (android/ios) project. We would like to delete some specific (not all) old cached files.

When the user switches in game quality, we re-download some asset files, and would like to remove some of the old ones. So we would not want to re download everything again, just some specific files.

We use a webservice to download files, which generates the same urls for low/medium/high quality files. So we can't just re download the file with the same url, because it's the same version, so unity won't download them again.

Is there a way to delete specific cached files?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
6

Answer by ricardo_arango · Jul 22, 2013 at 10:02 PM

In Unity 4.2 it is now possible to pass a CRC check for the file when you use LoadFromCacheOrDownload. If the CRC passed is different from what is calculated from the file in cache, the file will be considered to be in an invalid state and it will be deleted from the Cache. This is a trick you can use to delete specific files from the Cache:

http://docs.unity3d.com/Documentation/ScriptReference/WWW.LoadFromCacheOrDownload.html

The CRC for an AssetBundle is currently printed on the Editor log file after the AssetBundle is built. In an upcoming Unity 4.x version this value will be returned by the BuildAssetBundle function.

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
avatar image
0

Answer by originalNarf · Jan 23, 2013 at 11:52 PM

I'm looking (and failing to find) the same thing you are, but! LoadFromCacheOrDownload() provides a version number for this kind of problem. What you could do, I think, is increment the version number every time you change resolution, which according to the docs would force a new download every time.

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
avatar image
0

Answer by avianling · Nov 01, 2015 at 10:57 PM

Deleting a file from the cache is covered here: http://answers.unity3d.com/questions/23095/what-is-the-return-value-of-cachingdeletefromcache.html

Comment
Add comment · Show 1 · 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 JakeMuehleff0000 · Aug 19, 2016 at 05:57 PM 0
Share

The function described in this article is depreciated and does nothing.

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

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Clean Cache on Mobile 0 Answers

Asset Bundles with In-App Payment in Unity Mobile 1 Answer

Android multiple WWW freezes 0 Answers

WWW Post (Form) not working on mobile. 1 Answer

Does assetbundle work well with mobile devices? 1 Answer


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