i have tried to get the material 1 or… the second material in the material array as it has 2, and set it to the new material i have by doing this
LightObject.GetComponent<Renderer>().materials[1] = LightOnMat;
yet to no success
how do i set the material not the texture of the second place in the array?
thanks in advance!
I actually found it quite easy after taking a break from it, if you want here is the code. you need to get the list apply the material to the index, and then set the list again -.- stupid me!
CurMaterial = LightObject.GetComponent<Renderer>().materials;
CurMaterial[1] = LightOnMat;
LightObject.GetComponent<Renderer>().materials = CurMaterial;