public void DownloadAsset(IWWWAsync receiver, string url, System.Type type) { if (!mDownloadedObjects.ContainsKey(url)) { // Add to the downloading list if (!mDownloadingAssets.ContainsKey(url)) { List <IWWWAsync> receivers = new List <IWWWAsync>(); receivers.Add(receiver); mDownloadingAssets.Add(url, receivers); GameObject newDownload = new GameObject(url); WWWDownload wwwDownload = newDownload.AddComponent <WWWDownload> (); wwwDownload.StartDownload(receiver, url, type); } else { List <IWWWAsync> receivers = mDownloadingAssets[url]; receivers.Add(receiver); mDownloadingAssets[url] = receivers; } } else { // Get it from the cache receiver.AsyncUpdate(DownloadState.COMPLETED, mDownloadedObjects[url], null); } }
public static WWWDownload DownLoad(string url) { var d = new WWWDownload() { ID = WWWID++ }; return(d.download(url)); }