TrailRenderer colors in code

Sorry for all the questions, but I’m stumped on this one. The TrailRenderer component has an array of colors that you can customize in the Unity GUI. I would like to customize them in script, but I can’t figure out how to do it (as the colors array is apparently not a modifiable field of the class??). For now, I’m only worried about alpha, though having access to the other properties would be nice. I tried to alter the alpha through the material, but when I try to set the material color, I get an error which essentially tells me that the shader doesn’t have a “_Color” property. I tried the other common properties (SpecColor, EmissiveColor, etc.) but didn’t find anything. I’m using the provided “Particles/Additive” shader.

Any thoughts on how to access the colors array?
Alternatively: Any way to view the properties of the shader? (I don’t know where to find the shader code source)

Thanks as always! I really appreciate it!

Try making another material in the color that you need to change to and then material.Lerp to it.

Alex.

You can download the built in shaders here:

http://forum.unity3d.com/viewtopic.php?t=2150

I think you can’t access the trail renderer’s colors through code. You can however roll your own (I did right here: http://forum.unity3d.com/viewtopic.php?t=5246)