I’ve played some time with the new API and I have the following problems/improvements:
1 - Problems reporting download progress: I tried to download a simple JPG with the following code and I see values like 0, 0.997655, 0.7487621, 0.8035932, 0.689096… With no sense at all.
IEnumerator Test() {
UnityWebRequest request = UnityWebRequest.Get(Url);
request.Send();
while (!request.isDone) {
Debug.Log(request.downloadProgress);
yield return null;
}
Debug.Log("DONE");
}
2 - Allow to select texture format: In WWW you could instantiate a Texture with a custom format (DXT1, DXT5, RGB24, ARGB32…)
But with this simple API it’s not possible:
UnityWebRequest request = UnityWebRequest.GetTexture(uri);
Texture2D texture = (request.downloadHandler as DownloadHandlerTexture).texture;
3 - Expose specialized handlers for “AudioClip” and “MovieTexture”: I saw in google docs this text:
“A Specialized Download Handler for Audio Clips will also be available by launch.”
But there is no mention to MovieTexture class.
Also there should also be allowed to stream audio and video like with WWW class.
4 - Expose a method using generics to cast handlers: Now we have to do this that it’s not really clean code:
Texture2D texture = (request.downloadHandler as DownloadHandlerTexture).texture;
For example:
Texture2D texture = request.GetHandler<DownloadHandlerTexture>().texture;