public void ClearCache() { while (filePageCacheQueue.Count > 0) { FilePageCache cacheToDestory = filePageCacheQueue.Dequeue(); foreach (GameObject fileOverview in cacheToDestory.fileOverviews) { if (fileOverview != null) { Destroy(fileOverview); } } } }
void SaveCache() { FilePageCache filePageCache = new FilePageCache(this); if (filePageCacheQueue.Count >= 4) { FilePageCache cacheToDestory = filePageCacheQueue.Dequeue(); foreach (GameObject fileOverview in cacheToDestory.fileOverviews) { Destroy(fileOverview); } } filePageCacheQueue.Enqueue(filePageCache); }