So these are three GUITextures? Instead of using tags, I would use a GameObject array and then just disable elements from there. So, something like this:
var hearts : GameObject[];
private var clickCount : int = hearts.length;
function Update () {
if(Input.GetMouseButtonDown(0)){
var ray : Ray = Camera.main.ViewportPointToRay (Vector3(0.5,0.5,0));
var hit : RaycastHit;
if(Physics.Raycast (ray, hit, 100)){
if (hit.collider.tag == "click") {
hearts[clickCount].enabled = false;
clickCount--;
}
}
}
}
Simply tag the object you want to click with the ‘click’ and add your GUITextures to the hearts array and you’re good to go. I think it should work, but I created on air so I’m not so sure if it will …