Transparent shaders

Ok so I seem to get how I would change the opacity of one of the default transparent shaders.

My code here works fine:

    Renderer currentRend = gameObject.GetComponentInChildren<Renderer>();
    foreach (Material m in currentRend.materials) {
    	if (m.color.a < 1) {
    	        m.color = new Color(m.color.r, m.color.g, m.color.b, Mathf.Clamp(m.color.a + (1 * Time.deltaTime), 0, 255));

Sweet, cool, the issue I am having is how to set the initial transparency.

So I am using the 3rd person cop model from one of the tutorials, I apply any transparent shader to it and immediately the entire subsection of the model goes transparent, even if the alpha is 255.

Changing the alpha value changes the transparency as expected, however I can never get to full transparent or full opaque.

I tried using both 0-1 and 0-255 as alpha ranges since the docs say 0-1 but the editor shows me a value between 0-255.

It’s clearly a case of user-error, but after an hour or so searching for the answer its time to just ask.

void Update()
	Renderer currentRend = gameObject.GetComponentInChildren();
	foreach (Material m in currentRend.materials)
		m.color = new Color(m.color.r, m.color.g, m.color.b, Mathf.Repeat(Time.time, 1));

try this. this works. shader must be transparent. no other renderers should be.