This is my code:
void Update () {
if(Input.GetKeyDown(KeyCode.R))
{
gameObject.GetComponent<Renderer>().material.color = Color.red;
}
}
Then i get this error:
Assets/Color.cs(9,84): error CS0117: Color' does not contain a definition for red’
Can someone help me im new to Unity and im following the unity C# scripting tutorials
Assets/Color.cs
Your script is named the same thing as a Unity type Color.
Rename your script from Color to ColorScript or something like that.