How to assign texture from url

So I wrote this method:

public static IEnumerator ApplyFromWeb(string url, Texture texture)
        {

            WWW webLink = new WWW(url);
            yield return webLink;
            texture = webLink.texture;
        }

And calling it like this. But it doesn’t work. Help please!

void Update()
    {
        if (Input.GetKeyDown(KeyCode.W))
        {
            StartCoroutine(BWeb.ApplyFromWeb("http://i.imgur.com/1ArJsU7.jpg", lol));
            
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            GetComponent<MeshRenderer>().material.mainTexture = lol;

        }
    }

Hi,

First place log at the last of the Coroutine to check is the texture downloaded properly.
Then check the following steps

I think you have 2 mistakes in your code( I may be wrong but please cross check)

  1. Use Texture 2D instead of Texture

  2. Fist declare a public texture2D downloadedTex in your ‘BWeb’ script then assign that downloading texture to the ‘downloadedTex’ then

    GetComponent().material.mainTexture = BWeb.downloadedTex;
    Please check the same and tell us.

Thanks