Hello guys,
Im completely new to programming, and I’ve been trying for days to get a cubes color to turn from white to red at the press of the T button, and to turn from Red to White at the press of the T button again. Can someone tell me where i’m going wrong here is my code that I’ve tried. Im currently trying to learn C#.
public class colortogglesimple : MonoBehaviour {
void Start (){
}
void Update(){
if (Input.GetKeyDown ("t"))
renderer.material.color = Color.red;
else
renderer.material.color = Color.white;
}
}