What's wrong with this array assignment?

Hey,

this is a pretty simple piece of code and I have no idea why it wouldn’t work.

for(int i=0;i<tempArray.Length;++i)
				{
					m_PrevAlphas.Add(tempArray*.materials);*
  •  		}*
    
  •  		for (int i=0; i<tempArray.Length; ++i)*
    
  •  	{*
    
  •  		Color newColor = new Color (1.0f, 1.0f, 1.0f, m_TransparentAmount);*
    

_ for(int j=0;j<tempArray*.materials.Length;++j)_
_
{_
Texture tempTexture=tempArray.materials[j].GetTexture("MainTex");
tempArray.materials[j]=m_Mat; //THIS GETS IGNORED*

tempArray*.materials[j].SetTexture("MainTex",tempTexture);*
tempArray*.materials[j].color=newColor;*

* }*
* }*
Any idea why it wouldn’t get the Mat in tempArray*.materials[j]=m_Mat to my m_Mat? I checked the value of m_Mat and it is def valid, and there is already a material in that array that I can see so I know there is space in memory for it.*

Ok found the answer.

Basically, you can’t re-assign values in the array, but you can re-assign the entire array. Should of thought of that earlier with how C# works.