Objects do different things when clicked on

Hi,
So I basically created a cube set it to a prefab and duplicated 2 others from it to do the same functions. I am trying to create a main menu having start game, exit and instructions/how to play. My problem is that when I try to make the objects do different things they all do the same thing. I thought it was the case of the prefab but I am not sure, I do not think it is because I tried redoing it without creating a prefab and the result was the same. After that I tried using the tag system but same result again. The result is that they all turn red, including the start object. Below is part of the code I am using(where I am having trouble), I did it so they change color when clicked on just to know that they are working as I want them to. I just started unity so I am a bit low on experience. If anyone can help I appreciate it. Thanks a lot in advance! :slight_smile:

I have also tried the following and inserting start in the if statement:

var start : GameObject;
start = GameObject.Find("/Start");

function OnMouseUp()
{

   if(GameObject.FindGameObjectWithTag("MenuItemExit"))
   {
	renderer.material.color = Color.red;
   }

   else(GameObject.FindGameObjectWithTag("MenuItemStart"))
   {
	renderer.material.color = Color.black;
   }

}

FindGameObjectWithTag() looks into the scene and returns the first object it finds with that tag. If you have any object in the scene with that tag, then the ‘else’ clause will never execute. I’m assuming you have this script attached to several blocks. If so, you can check if the block clicked on has the specified tag:

 if(gameObject.tag == "MenuItemExit"))
   {
    renderer.material.color = Color.red;
   }