Cant convert Color to Color

So im trying to make a script where the color of a point is dependen on the distance of the player and i get with every thing that has color the error that says “Cannot implicitly convert type ‘Color’ to ‘UnityEngine.Color’” and i dont know how to fix it!

heres my script:

public Gradient gradient;
public Transform player;
public GameObject point;
private float dist;

void Update()
{
    dist = Vector3.Distance(point.transform.position, player.position);
    Color col = gradient.Evaluate(dist);
    point.GetComponent<Renderer>().material.color = col;
}

}

There’s quite a lot missing from your code if you want to use Gradient.Evaluate. For example, you need to set up a gradient curve. Also, the parameter to Evaluate is in the range 0 to 1 so, as soon as you are 1 unit away from Point, the colour won’t change any more. Perhaps you ought to set a max distance so that the colour will vary within that space but not beyond it.

Here’s some sample code that makes “point” white when player is near but black when player is further away. In this case, I’ve set Max Distance to be 10 units.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Test2 : MonoBehaviour
{
	[SerializeField] float maxDistance = 10;

	Gradient gradient;
	GradientColorKey[] colorKey;
	GradientAlphaKey[] alphaKey;

	public Transform player;
	public GameObject point;
	private float dist;

	void Start()
	{
		CreateGradient();
	}

	void Update()
	{
		dist = Vector3.Distance(point.transform.position, player.position);
		Color col = gradient.Evaluate(dist/maxDistance);
		point.GetComponent<Renderer>().material.color = col;
	}

	void CreateGradient()
	{
		gradient = new Gradient();

		colorKey = new GradientColorKey[2];
		colorKey[0].color = Color.white;
		colorKey[0].time = 0;
		colorKey[1].color = Color.black;
		colorKey[1].time = 1;

		alphaKey = new GradientAlphaKey[2];
		alphaKey[0].alpha = 1;
		alphaKey[0].time = 0;
		alphaKey[1].alpha = 1;
		alphaKey[1].time = 1;

		gradient.SetKeys(colorKey, alphaKey);
	}
}