Texture Array getting the last index only ( C# UNITY) : <p>I'm creating an array of Texture so I'm doing it like this</p>

<pre><code>[SerializeField] GameObject[] uitex = new GameObject[4];

void GetTextureFromServer()
{
    string dealer_image = "";
    var tex = new Texture2D(20, 20);

    for (int i = 0; i &lt; tzPlayInfo.Instance.bc_gametablelist.Count; i++)
    {
        dealer_image += tzPlayInfo.Instance.bc_gametablelist[i].dlrimage;
        dealer_image += ",";

    }
    string[] NewLinks = dealer_image.Split(',');


    for(int j = 0; j &lt; NewLinks.Length - 1; j++)
    {
        Debug.Log("HERE ARE THE LINKS : " + NewLinks[j]);

        new BestHTTP.HTTPRequest(new System.Uri("***********.amazonaws.com/resources" + "/dealer/pic/" + NewLinks[j]),
            (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res) =&gt;
            {
                tex.LoadImage(res.Data);
            }).Send();
    }

    for (int i = 0; i &lt; uitex.Length; i++)
    {
        uitex[i].GetComponent&lt;UITexture&gt;().mainTexture = tex;
    }
}
</code></pre>

<p>What i tried so far is this</p>

<pre><code>uitex[j].GetComponent&lt;UITexture&gt;().mainTexture = tex;
</code></pre>

<p>But it gives me an array is out of range and i don't know why.</p>

<p>The problem with this code is that it always gets the last index i have so all 4 gameobject has the same all textures and that's not what i want. Could someone please help me with my problem . Thank you.</p>
