Streaming large texture through WWW or otherwise. (multiple passes)

I am developing an application for the web (flash and/or web player), and need to keep the size of the application to a minimum.

For this project I need a couple of large 4096x4096 png textures. I have to download these from the web at run time.

I have read around here that WWW.texture cannot “stream” a texture (as in, download an interlaced png in multiple passes). You must always yield until the whole image downloads.
I need this functionality, otherwise the user will stare at nothing (or a very very low res placeholder) for quite a few seconds until the whole thing is done.

So I am trying to come up with alternatives.

Can anyone tell me how exactly does this WWW functionality work under the hood? It seems very odd to me that we don’t have access to the partially downloaded data in this kind of www request.

What exactly does do? Could I read a partial stream of data from there, and encode it to an image/texture and show it to the user?

The only other alternative I can think of, is to load the images in the enclosing HTML page, then use periodic external calls from unity to fetch whatever data has been loaded so far in the . It feels like I shouldn’t have to resort to this.

using System;
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Networking;

public class ImageDownloader : MonoBehaviour {
UnityEngine.UI.Image _img;

private Action del_action;
private UnityWebRequest wr;
private DownloadHandlerTexture texDl;
private Texture2D texture;
private Sprite sprite;

void Start () {
	_img = GetComponent<UnityEngine.UI.Image>();


void Update () {

	if (Input.GetKeyDown (KeyCode.Space)) {
		Debug.Log ("Started");
		Download ("");


	if (del_action != null) {
		del_action ();


public void Download(string url) {

	texture = new Texture2D (2, 2);
	wr = new UnityWebRequest(url);
	texDl = new DownloadHandlerTexture(true);
	wr.downloadHandler = texDl;
	wr.chunkedTransfer = true;


	del_action += Downloadupdate;


private void Downloadupdate()

	if ( wr.downloadProgress > 0.1f ) {

		//texture.LoadRawTextureData (;
		texture.LoadImage (;
		//texture = texDl.texture;

		if ( sprite == null ) {

			sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height),, 1f);
			_img.sprite = sprite;



	if (wr.isDone) {

		del_action -= Downloadupdate;

		texture = texDl.texture;