Any alternatives? Perhaps I should use WWW.Bytes and somehow transform that array of bytes from .ICO to .PNG?
Quote from Unity3D Docs:
The data must be an image in JPG or PNG format. If the data is not a
valid image, the generated texture will be a small image of a question
mark.
And indeed, that’s what I am getting — a red-question-mark photo! I am 100% sure that I am passing the correct link of the .ICO file and successfully downloading it.
Here’s the download code:
void Update()
{
if (gotIconURL && !gotIconTexture)
{
//StopCoroutine("GetIcon");
StartCoroutine("GetIcon");
gotIconURL = false; // We don't have the new/future icon URL
}
}
IEnumerator GetIcon()
{
///NOTE!
///Each invocation of texture property allocates a new Texture2D, do something about it!
///If I continously download textures I must use LoadImageIntoTexture or Destroy the previously created texture.
// Start a download of the given URL
var www = new WWW(iconURL); // e.g. https://www.google.com/favicon.ico
//Debug.Log(iconURL);
// Wait for download to complete
yield return www;
// Assign texture
rawIcon.texture = www.texture;
gotIconTexture = true;
}
Any ideas?