UnloadUnusedAssets() public static method

public static UnloadUnusedAssets ( ) : AsyncOperation
return AsyncOperation
コード例 #1
0
        /// <inheritdoc cref="UnityResources.UnloadUnusedAssets()"/>
        public static AsyncOperation UnloadUnusedAssets()
        {
            AsyncOperation operation = UnityResources.UnloadUnusedAssets();

            operation.completed += unloadCacheAsync;
            return(operation);
        }
コード例 #2
0
 /// <summary>
 /// 清空资源
 /// </summary>
 /// <param name="gc">If set to <c>true</c> gc.</param>
 public void ClearCache(bool gc)
 {
     lstRefAsset = new LRUCache <string, UObj>(MAX_CAPACITY, MAX_CAPACITY);
     unUsedUObj  = 0;
     if (gc)
     {
         URes.UnloadUnusedAssets();
     }
 }
コード例 #3
0
 void releaseRes(KeyValuePair <string, UObj>[] toBeRm)
 {
     if (toBeRm != null)
     {
         unUsedUObj += toBeRm.Length;
         if (unUsedUObj >= MAX_UNUSED_OBJ)
         {
             URes.UnloadUnusedAssets();
         }
         unUsedUObj = 0;
     }
     toBeRm = null;
 }
コード例 #4
0
        public void Destory(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }
            bool exist = lstRefAsset.Delete(name);

            if (exist)
            {
                unUsedUObj++;
            }
            if (unUsedUObj >= MAX_UNUSED_OBJ)
            {
                URes.UnloadUnusedAssets();
            }
            unUsedUObj = 0;
        }
コード例 #5
0
ファイル: ResourceMgr.cs プロジェクト: wxl-007/ShadowDota
        /// <summary>
        /// 清空资源
        /// </summary>
        /// <param name="gc">If set to <c>true</c> gc.</param>
        public void ClearCache(bool gc)
        {
            KeyValuePair <string, AssetBundle>[] all = lstRefAsset.Clear();
            if (all != null)
            {
                int len = all.Length;
                if (len <= 0)
                {
                    return;
                }
                for (int i = 0; i < len; ++i)
                {
                    all[i].Value.Unload(true);
                }
            }

            if (gc)
            {
                URes.UnloadUnusedAssets();
            }
        }