예제 #1
0
        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);
        }
예제 #2
0
        /// <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();

        }
예제 #3
0
 private void Update()
 {
     AbstractResourceLoader.CheckGcCollect();
 }