Color index operator not working properly

Unanswered as of Feb 20, 2014 11:50am PST.

I am trying to use the Index operator on the material color for a basic object using the default material.
Here is the code I am trying to make work but for some reason isn’t:

var i : int;
	for (i=0; i<4; i++) {
		if (this.rgba *> 1) {*

_ this.rgba = 1;_
* }*
_ else if (this.rgba < 0) {
this.rgba = 0;
* }_
this.renderer.material.color _= this.rgba;
}
Based on [This Link][1] it should work the same as the follow (Which does work):
var i : int;
for (i=0; i<4; i++) {
if (this.rgba > 1) {
this.rgba = 1;
}
else if (this.rgba < 0) {
this.rgba = 0;
}
}
this.renderer.material.color.r = this.rgba[0];
this.renderer.material.color.g = this.rgba[1];
this.renderer.material.color.b = this.rgba[2];
this.renderer.material.color.a = this.rgba[3];
Could someone explain why this isn’t working for me.
I am calling this in my update function.
rgba is a instance variable float[4];
Using JavaScript.
Unity version 4.3.3f1 on Windows 7
Sources that my logic is based on
Unity - Scripting API: Color.this[int]
http://docs.unity3d.com/Documentation/ScriptReference/Material.html*_
*http://docs.unity3d.com/Documentation/ScriptReference/Color.html*_
Update
I have tried another method of achieving this (that works) but I still don’t know why the first method in the post isn’t working (In JAVASCRIPT).
var i : int;
var c : Color = this.renderer.material.color;
for (i=0; i<4; i++) {
if (this.rgba > 1) {
this.rgba = 1;
}

else if (this.rgba < 0) {
this.rgba = 0;
* }_
c _= this.rgba;
}
this.renderer.material.color = c;_

[1]: Unity - Scripting API: Color.this[int]*

Same problem as on this Stack Overflow thread. I’ll post a similar answer here.

In C#, structs are passed by value.

When you get material.color, you’re getting a copy of the material’s color; changes made to the copy do not alter the original.

The following doesn’t work, because you’re modifying and discarding a copy:

renderer.material.color.a = 0;

The following does work, because you’re getting a copy, modifying it, and passing it back:

Color tempColor = renderer.material.color;
tempColor.a = .25f;
renderer.material.color = tempColor;