public static IEnumerator Dispose() { IsInitialising = true; ProgressManager.RemoveProgressBars("Unload Asset Bundles"); int progressID = Progress.Start("Unload Asset Bundles", null, Progress.Options.Sticky); int bundleID = Progress.Start("Bundles", null, Progress.Options.Sticky, progressID); int prefabID = Progress.Start("Prefabs", null, Progress.Options.Sticky, progressID); Progress.Report(bundleID, 0f); Progress.Report(prefabID, 0f); PrefabManager.ReplaceWithDefault(PrefabManager.CurrentMapPrefabs, prefabID); while (PrefabManager.IsChangingPrefabs) { yield return(null); } for (int i = 0; i < BundleCache.Count; i++) { Progress.Report(bundleID, (float)i / BundleCache.Count, "Unloading: " + BundleCache.ElementAt(i).Key); BundleCache.ElementAt(i).Value.Unload(true); yield return(null); } int bundleCount = BundleCache.Count; BundleLookup.Clear(); BundleCache.Clear(); AssetCache.Clear(); Progress.Report(bundleID, 0.99f, "Unloaded: " + bundleCount + " bundles."); Progress.Finish(bundleID, Progress.Status.Succeeded); IsInitialised = false; IsInitialising = false; }
public void UnLoadAll() { foreach (var item in AssetCache.Values) { item.Dispose(); } AssetCache.Clear(); }
private void HandleClearAssets(string module, string[] args) { if (AssetCache != null) { AssetCache.Clear(); } else { m_log.Info("Asset cache is not configured."); } }