void CreateLoadedResource(string path, Type type, UnityEngine.Object obj)
        {
            LoadedResource loaded = GetLoadedResource(path, type);

            if (loaded != null)
            {
                if (AssetManagerSetting.IsCacheResourceAsset)
                {
                    loaded.obj = obj;
                }
                loaded.referencedCount++;
            }
            else
            {
                loaded = new LoadedResource(path, type);
                if (AssetManagerSetting.IsCacheResourceAsset)
                {
                    loaded.obj = obj;
                }

                if (!m_LoadedResources.ContainsKey(type))
                {
                    m_LoadedResources.Add(type, new Dictionary <string, LoadedResource>());
                }

                m_LoadedResources[type].Add(path, loaded);

                LoadedResourceList.Add(loaded);
            }
        }
        public void UnloadResource(string path, Type type, int count, bool isSetLastTime)
        {
            LoadedResource loaded = GetLoadedResource(path, type);

            if (loaded != null)
            {
                if (count < 0)
                {
                    loaded.referencedCount = 0;
                }
                else
                {
                    loaded.referencedCount -= count;
                }



                if (loaded.referencedCount <= 0)
                {
                    if (isSetLastTime)
                    {
                        loaded.lastTime = Time.unscaledTime;
                    }

                    if (!AssetManagerSetting.UseCacheAssetTime)
                    {
                        UnloadLoadedResourceCache(loaded);
                    }
                }
            }
        }
 public void LoadResourceAsync(string path, System.Type type, Action <string, object, object[]> callback, params object[] callbackArgs)
 {
     if (AssetManagerSetting.IsCacheResourceAsset)
     {
         LoadedResource loaded = GetLoadedResource(path, type);
         if (loaded != null)
         {
             loaded.referencedCount++;
             if (callback != null)
             {
                 callback(path, loaded.obj, callbackArgs);
             }
             return;
         }
     }
     StartCoroutine(OnLoadResourceAsync(path, type, callback, callbackArgs));
 }
        void UnloadLoadedResourceCache(LoadedResource loaded)
        {
            if (loaded.obj != null)
            {
                try
                {
                    Resources.UnloadAsset(loaded.obj);
                }
                catch (Exception e)
                {
                    Debug.LogError("AssetManager_Resoures UnloadLoadedResourceCache e=" + e);
                }
            }

            loaded.obj = null;
            RemoveLoadedResource(loaded.path, loaded.objType);
        }