public void OnLoad(string tag, LoadPath loadPath, DataSet data, Callback <Sprite> callback) { CDebug.Log("load texture success " + loadPath.path); Texture2D texture2d = null; if (TextureCache.Instance.Contains(loadPath.path)) { texture2d = TextureCache.Instance.Get(loadPath.path).texture2d; } else { texture2d = ByteConvert.BytesToTexture2D(data.bytes); } texture2d.wrapMode = TextureWrapMode.Clamp; Sprite sprite = ByteConvert.CreateImage(texture2d); TextureCache.Instance.AddCache(loadPath.path, texture2d); SpriteCache.Instance.AddCache(loadPath.path, sprite); Callback unload = () => { TextureCache.Instance.UnloadCache(loadPath.path); SpriteCache.Instance.UnloadCache(loadPath.path); }; AddToUnloadTask(tag, unload); if (callback != null) { callback(sprite); callback = null; } }