Error CS0118 Issue

Here is my code:

using System.Collections;
using UnityEngine;

public class TernaryOperatorExample : MonoBehaviour
{
    public int health = 0;
    private string message;
    delegate void MultiDelegate();
    MultiDelegate myMultiDelegate;
    public Color thecolor;
 // Use this for initialization
 void Start()
 {
    thecolor = GetComponent<MeshRenderer.material.color>;
    message = health > 0 ? "Player is alive" : "Player is dead";
    Debug.Log(message);
    myMultiDelegate += transform.ResetTransformation;
    myMultiDelegate += RandColor;

    if (myMultiDelegate != null)
    {
        myMultiDelegate();
    }

}

    public void RandColor()
    {
        thecolor = RandColor;
    }

}

    public static class ExtensionMethods {
        public static void ResetTransformation(this Transform trans) {
            trans.position = Vector.zero;
            trans.localRotation = Quaternion.identity;
            trans.localScale = new Vector3(1, 1, 1);
        }
}

And here is the Error message:

error CS0118: UnityEngine.Renderer.material' is a property access’ but a `type’ was expected.

What is the issue here?

Hello, please give the full error next time(with the line number).

That line should be:

thecolor = GetComponent<MeshRenderer>().material.color;

Why? GetComponent<>() is a generic method to grab a component off of a GameObject. You passed a Color struct into the generic method as the type to get. This is invalid since a Color struct is not a valid Component. So first, grab the component and then access it’s properties.