HI guys,
I am trying to write a script to change the gameobjects’ color once the player click on that particular object,I tried to use that OnMouseDown() , however it doesn’t seem to work, here are some of my code :
function OnMouseDown()
{
if (renderer.material.color != Color.green)
{
renderer.material.color = Color.green;
}
else
{
renderer.material.color = Color.red;
}
}
I have actually tried to use Update() instead of OnMouseDown(), and adding " if (Input.GetButtonDown(“Jump”))'" and it works once i press the jump key and the objects color changed.