public static KResourceLoaderDebugger Create(string type, string url, AbstractResourceLoader loader) { if (IsApplicationQuit) { return(null); } Func <string> getName = () => string.Format("{0}-{1}-{2}", type, url, loader.Desc); var newHelpGameObject = new GameObject(getName()); KDebuggerObjectTool.SetParent(bigType, type, newHelpGameObject); var newHelp = newHelpGameObject.AddComponent <KResourceLoaderDebugger>(); newHelp.TheLoader = loader; loader.SetDescEvent += (newDesc) => { if (loader.RefCount > 0) { newHelpGameObject.name = getName(); } }; loader.DisposeEvent += () => { if (!IsApplicationQuit) { KDebuggerObjectTool.RemoveFromParent(bigType, type, newHelpGameObject); } }; return(newHelp); }
/// <summary> /// Collect all KEngine's resource unused loaders /// </summary> public static void Collect() { while (AbstractResourceLoader.UnUsesLoaders.Count > 0) AbstractResourceLoader.DoGarbageCollect(); Resources.UnloadUnusedAssets(); System.GC.Collect(); }
private void Update() { AbstractResourceLoader.CheckGcCollect(); }