I’m trying to convert coroutines to Tasks using:
It’s on Github too:
https://github.com/svermeulen/Unity3dAsyncAwaitUtil
This asset doesn’t provide progress report with IProgress interface.
I’m trying to do it but I don’t know how.
Any of you has already attempted to do this?
Thanks.
2 Likes
The code below works on 2018.2.0f2 as a sample:
public class NewBehaviourScript : MonoBehaviour
{
public Slider Slider;
private WWW www;
private void Update () {
if (www != null) {
Slider.value = www.progress;
}
}
public void OnClick() {
SampleWWWAsync("https://speed.hetzner.de/100MB.bin");
}
private async void SampleWWWAsync(string url) {
Debug.Log("Begin");
www = new WWW(url);
await www;
Debug.Log("End");
www.Dispose();
www = null;
}
}
So, I don’t know should I dispose both of www and await www. It would be useful if someone explain something about it.