Skip to content

Instantly share code, notes, and snippets.

@fumobox
Last active November 18, 2015 08:16
Show Gist options
  • Save fumobox/8040e945f71f79cd4020 to your computer and use it in GitHub Desktop.
Save fumobox/8040e945f71f79cd4020 to your computer and use it in GitHub Desktop.
CacheManager.cs
using UnityEditor;
using UnityEngine;
using System.IO;
using System.Collections;
public static class CacheManager {
[UnityEditor.MenuItem("Cache/Clear Caches")]
public static void Clear() {
Debug.LogWarning("Delete " + Application.persistentDataPath);
Directory.Delete(Application.persistentDataPath, true);
PlayerPrefs.DeleteAll();
if (Caching.CleanCache ())
{
Debug.LogWarning ("Clear cache: success");
}
else
{
Debug.LogWarning ("Clear cache: failed");
}
}
[UnityEditor.MenuItem("Cache/Clear PlayerPrefs")]
public static void ClearPlayerPrefs()
{
PlayerPrefs.DeleteAll();
}
[UnityEditor.MenuItem("Cache/Open PersistentDataPath")]
public static void OpenPersistentDataPath()
{
OpenInFileBrowser.Open(Application.persistentDataPath);
}
[UnityEditor.MenuItem("Cache/Open DataPath")]
public static void OpenDataPath()
{
OpenInFileBrowser.Open(Application.dataPath);
}
[UnityEditor.MenuItem("Cache/Open TemporaryCachePath")]
public static void OpenTemporaryCachePath()
{
OpenInFileBrowser.Open(Application.temporaryCachePath);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment