www.Texture V.S. LoadImageIntoTexture()

I’m creating an app in Unity were we load a lot a textures into Unity at start up and during run time (any where from 25 to 100 @ 4096x4096). Mostly for testing downloading we have been using:

WWW www = new WWW(url);

//Wait for the Download
yield return www;

if (!string.IsNullOrEmpty(www.error))
    IQDebug.Log("WWW Error: " + www.error);
else
{
    Texture2D image = www.texture;
}

But recently in my travels on the internet I have found:

LoadImageIntoTexture()

Does anyone happen to know which one is supposed to be used for certain situations? and whats the best for performance?

Thanks for your time!

I’m not entirely sure.

www.texture or www.textureNonReadable create and give you a new texture.

LoadImageIntoTexture puts the image into the texture you give it.

As far as I know this is the only difference and all you save is the overhead of creating a new texture.

using www.texture is probably bad in most circumstances. It creates a duplicate of the texture in memory that doesn’t get properly disposed of. Just dealt with this for the last couple days, killing memory leaks all over my app.

See here: