Change Materials Over Time

ok let’s say that i have material 1 (blue) and material 2 (red) and i want the object (cube) to change from blue to red over time. Do i use the animator or do i use coding. If coding could u please use javascript

You can use material.Lerp - the example in the docs (see below) blends forth and back between two given materials over time:

// Blends between two materials

var material1 : Material;
var material2 : Material;
var duration = 2.0;

function Start () {
    // At start, use the first material
    renderer.material = material1;

function Update () {
    // ping-pong between the materials over the duration
    var lerp : float = Mathf.PingPong (Time.time, duration) / duration;
    renderer.material.Lerp (material1, material2, lerp);

Notice that only a few material properties are Lerp’ed: color and some float properties, not textures or shaders. If you want to blend two materials with different textures, maybe this answer can solve your problem.