/// <summary> Create or return cached texture </summary> public IEnumerator GetTextureCached(bool linear, Action <Texture2D, GLTFImage.TextureOrientation> onFinish, Action <float> onProgress = null) { if (cache == null) { yield return(StaticCoroutine.Start(image.CreateTextureAsync(linear, (x, y) => { cache = x; orientation = y; }, image.mimeType, onProgress))); } onFinish(cache, orientation); }
/// <summary> Create or return cached texture </summary> public IEnumerator GetTextureCached(bool linear, Action <Texture2D> onFinish, Action <float> onProgress = null) { if (cache == null) { IEnumerator en = image.CreateTextureAsync(linear, x => cache = x, onProgress); while (en.MoveNext()) { yield return(null); } ; } onFinish(cache); }