private FetchedResourceRef RetainInternal(string url, EType type, bool threeD, bool streaming) { FetchedResourceRef fetchedres = FindFetchedRes(url); WWW fetchedWWW = FindFetchedWWW(url); if (fetchedres == null && fetchedWWW == null) { DebugUtil.Error("attempt to retain an unfetched resource, url: " + url); return(null); } else if (fetchedres != null) { fetchedres.AddRef(); return(fetchedres); } else if (fetchedWWW != null) { FetchedResourceRef res = new FetchedResourceRef(); res.type = type; res.SetObj(fetchedWWW, threeD, streaming); res.AddRef(); fetchedResourceMap[url] = res; fetchedWWW.Dispose(); fetchedWWWMap.Remove(url); return(res); } else //should never be here { throw new System.Exception("entering impossible code path"); } }
/* * public void LateUnloadUnusedAssets() * { * LastScript.NeedUnloadUnusedAssets = true; * }*/ public bool HasResource(string url) { FetchedResourceRef fetchedres = FindFetchedRes(url); WWW fetchedWWW = FindFetchedWWW(url); if (fetchedres == null && fetchedWWW == null) { return(false); } else { return(true); } }
public void Release(string url) { FetchedResourceRef res = FindFetchedRes(url); if (res == null) { return; } int refcount = res.Release(); if (refcount <= 0) { fetchedResourceMap.Remove(url); //LateUnloadUnusedAssets(); } return; }