/// <summary> /// Clear all existing tile caches. Deletes MBTiles database files. /// </summary> public void ClearSceneCache() { CachingWebFileSource cwfs = _fileSource as CachingWebFileSource; if (null != cwfs) { cwfs.Clear(); } }
public void ClearAllCacheFiles() { // explicity call Clear() to close any connections that might be referenced by the current scene CachingWebFileSource cwfs = _fileSource as CachingWebFileSource; if (null != cwfs) { cwfs.Clear(); } // remove all left over files (eg orphaned .journal) from the cache directory string cacheDirectory = Path.Combine(Application.persistentDataPath, "cache"); if (!Directory.Exists(cacheDirectory)) { return; } foreach (var file in Directory.GetFiles(cacheDirectory)) { try { File.Delete(file); } catch (Exception deleteEx) { Debug.LogErrorFormat("Could not delete [{0}]: {1}", file, deleteEx); } } //reinit caches after clear if (null != cwfs) { cwfs.ReInit(); } Debug.Log("done clearing caches"); }