Unity3dAsyncAwaitUtil icon indicating copy to clipboard operation
Unity3dAsyncAwaitUtil copied to clipboard

Add ability to get progress for AsyncOperation by passing an IProgress parameter

Open svermeulen opened this issue 8 years ago • 9 comments
trafficstars

svermeulen avatar Sep 23 '17 07:09 svermeulen

Any news on this?

bdominguez avatar Feb 02 '18 09:02 bdominguez

Not yet no. But you are welcome to give it a shot and submit a PR :)

svermeulen avatar Feb 02 '18 13:02 svermeulen

I don't know where to start. Could be adding some method like this on InstructionWrappers class?

public static IEnumerator WWWCreateRequest(
    SimpleCoroutineAwaiter<WWW> awaiter, WWW instruction, IProgress<float> progress) {
    while (!instruction.isDone) {
        progress.Report(instruction.progress);
        yield return null;
    }
    awaiter.Complete(instruction, null);
}

If you guid me I could try to do it.

bdominguez avatar Feb 02 '18 13:02 bdominguez

Honestly I'm not sure, I'd have to dig into it some more. It's been awhile since I was in that code, and I am swamped with other work right now

svermeulen avatar Feb 02 '18 18:02 svermeulen

I'm also interested on this.

There are some operations like downloading files that needs progress feedback.

bdovaz avatar Feb 04 '18 15:02 bdovaz

I was able to get progress using a modified form of the above with unity's messaging system. Drawback is you have to know the game object you're showing your progress for.

StephenHodgson avatar Feb 11 '18 17:02 StephenHodgson

In my case I want to completely get rid of GameObjects, MonoBehaviours to run a coroutine so I don't like that approach @StephenHodgson. I know that @svermeulen code has a MonoBehaviour that runs all coroutines from static methods but it's "transparent" for us and allows us to don't have dependencies in our own code to Unity API.

bdovaz avatar Feb 11 '18 18:02 bdovaz

@bdovaz That's def the way to go, but sometimes you have to use a Unity API. (That's kinda the whole point to this wrapper utility)

StephenHodgson avatar Feb 11 '18 18:02 StephenHodgson

Hey I was wondering if anyone managed to implement IProgress<> as part of the existing async patterns here? I've not been able to find a way to expose IProgress up to the await callee.

strich avatar Jun 27 '19 15:06 strich