atteneder / KtxUnity

Load KTX and Basis Universal textures at runtime
Apache License 2.0
221 stars 42 forks source link

[Request] Method style transcoder. #32

Closed gtk2k closed 3 years ago

gtk2k commented 3 years ago

I want a method style transcoder like this.

var loader = new BasisUniversalLoader();
var tex = loader.loadFromUrl(url);
material.mainTexture = tex;
atteneder commented 3 years ago

Working on a new async API. It'll look like this:

async void Start() {
    var loader = new BasisUniversalLoader();
    var result = await loader.LoadFromUrl(url);
    material.mainTexture = result.texture;
    Debug.Log(result.orientation); // Also contains orientation info
}

Similar complexity/boilerplate code, no fiddling with callbacks, but still async.

I don't know how to make it sync, but I also don't see any reason one would want that.

Any objections?

gtk2k commented 3 years ago

Oh! Yes! My request was incorrect. Asynchronous is okay. No synchronization required!

Thanx!