For some reason unity3d wont regconize the Color.red; in my script
#pragma strict
function Update ()
{
if(Input.GetKeyDown(KeyCode.R))
{
gameObject.renderer.material.color = Color.red;
}
if(Input.GetKeyDown(KeyCode.G))
{
gameObject.renderer.material.color = Color.green;
}
if(Input.GetKeyDown(KeyCode.B))
{
gameObject.renderer.material.color = Color.blue;
}
}
I’ve been trying to relearn unity coding, but the game engine says these colors arent apart of Color. I have no clue why this is, but any help would be great.
Come to this video for more information
I just tried the script, and it works fine. Compiles and changes the color as specified. Can you give us more information about the issues you are having?
– robertbuHave you written a script called Color yourself?
– whydoidoit