Changing Color of Tree Material

SO what I'm trying to do is Put some trees in my scene. I'm using a default tree from a Unity Package, the tree called Sycamore (With Collider). In the Inspector window I can change the color of the material for the leaves. What I want to do, is to figure out how to get the material for the leaves to animate, meaning as I play the game have the leaves start out green, go yellow, orange, red, then back again continuously. Does anyone have any idea how I can set that up? I'm pretty new to Unity and know next to nothing about scripting, though any suggestions would be greatly appreciated!

Maybe check out the Unity reference for material below...

link text

// Fade the color from red to green
// back and forth over the defined duration
var colorStart = Color.red;
var colorEnd = Color.green;
var duration = 1.0;

function Update () {
var lerp = Mathf.PingPong (Time.time, duration) / duration;
renderer.material.color = Color.Lerp (colorStart, colorEnd, lerp);
}

This old post was recently updated so I looked at it too. The issue is that the Sycamore has two materials and the proposed solution only chooses the first (the trunk).

You just need to change this line

renderer.material.color = Color.Lerp (colorStart, colorEnd, lerp);

to this

	renderer.materials[1].color = Color.Lerp (colorStart, colorEnd, lerp);

Since there is more than one material, just change it to reference to materials and add the [1] bit. I tested this on the Sycamore w/ Collider tree and the leaves changed.

Be aware that if you are building this functionality in the hopes of later moving it to your Terrain trees, that won’t work. I posted something about that awhile back and the code is pretty bad but at least it shows an idea