Load textures from www

Hi!
I have problem with load texture from “www”. This is my script:

var urll = "http://www.website.com/beton3.png";

function Start () {
// Start a download of the given URL
var www : WWW = new WWW (urll);

yield WaitForSeconds(2.0);

// assign texture
renderer.material.mainTexture= [url]www.texture;[/url]
}

I have a few textures on one max object and I want change for example second texture. This script changed first one. Anybody help me?
Thanks)

One problem with that script is that “yield WaitForSeconds(2.0);” doesn’t really work…you have to yield on the data itself. After 2 seconds it may or may not actually be done. Use code like you see in the Unity WWW docs.

–Eric

This script work but the question is:
How can I change second texture(material) on my object (I have created building in 3ds max and I use a few textures on one object).

You can use the material’s SetTexture function to set a texture by name.