/// <summary> /// 设置UITexture. /// </summary> /// <param name="url"></param> /// <param name="UITexture"></param> /// <returns></returns> public static IEnumerator SetTextureToUrl(string url, UITexture varTexture) { using (WWW www = new WWW(url)) { //挂起程序段,等资源下载完成后,继续执行下去; yield return(www); if (string.IsNullOrEmpty(www.error)) { if (varTexture != null && www.texture != null) { GifReader.GetImage(varTexture, www.bytes, string.Empty); } } www.Dispose(); } }