when i change the material of a game object the object disappears?

public Material redMaterial;
rend = GetComponent();

    if (c.gameObject.CompareTag("redLight"))
            rend.material = redMaterial;

any idea how to solve this issue??

Try using this instead and see if it works:

rend.materials[0] = redMaterial;

I usually find that assigning the materials based on their index is more reliable.