Click On Objects Within Scene

Hello,

I have no idea how to select objects within my scene that have a collider. I basically want a 2 scripts, one with the clickable command on, and another that makes a variable true if the click is true.

Here is what I have (Big Problem):

I have 3 cubes on my scene, all with the click script and the variable script (within different children). Now when I click on any of the cubes, the variable it true for all the cubes, I only want it true for that cube I just clicked on

(When clicked on cube, a texture is placed around it) - now if I click on one cube, the texture comes on for all the cube. Or sometimes different cubes activate the textures on another cube???

Heres my script:

ClickObject::

#pragma strict

var clicked : boolean = false;
var hit : RaycastHit;

static var ClickedOn : boolean = false;

function Update() {
    if(Input.GetMouseButtonDown(0) &&
       collider.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit, Mathf.Infinity)) {
        clicked = !clicked;
        if(tag == "Select") tag = "Unselect";
        else tag = "Select";
        //Debug.Log("clicked" + (clicked? "" : " off"));
    }

ClickedOn = clicked;

}

RadiusTexture:

var RadiusObject : Transform;
var RadiusSphere : Transform;
private var CurrentSize : float;

private var ScaleX = 3.1; //2
private var ScaleY = 0; //0
private var ScaleZ = 3.4; //2.3

private var ScaleXDiv : float = 0;
private var ScaleYDiv : float = 0;
private var ScaleZDiv : float = 0;

private var ScaleXNew : float = 0;
private var ScaleZNew : float = 0;

private var Clicked = false;
var MouseOverClicked = false;

var Texture = true;

function Update () 
{

    if(ClickObject.ClickedOn == true)
    {
        if(Texture == true)
        {
            CurrentSize = collider.radius;

            ScaleXDiv = (ScaleX * CurrentSize);
            ScaleXNew = ScaleXDiv / 10;

            ScaleZDiv = (ScaleZ * CurrentSize);
            ScaleZNew = ScaleZDiv / 10;

            RadiusObject.transform.localScale = Vector3(ScaleXNew,ScaleY,ScaleZNew);
        }
        else
        {
            CurrentSize = collider.radius;
            RadiusSphere.transform.localScale = Vector3(CurrentSize * 3,CurrentSize * 3,CurrentSize * 3);

        }
        //Clicked = true;
    }
    else if(ClickObject.ClickedOn == false)
    {

        RadiusObject.transform.localScale = Vector3(0,0,0);
        RadiusSphere.transform.localScale = Vector3(0,0,0);

        //Clicked = false;

    }
}

What I want is for the cube clicked - to activate the texture, and not interfere with the other cubes/textures

Thanks

I think you should have a look at this question first. Looks very similar:

http://answers.unity3d.com/questions/28481/clickable-object-problem-help

I believe its all about making the object you can click have the script itself, thats the "object oriented way of doing stuff". You attach the triggerscript to "clickable stuff" instead of a screen/mouse object that scans from point of view.

did you duplicate the other two cubes from the original cube? If so, that may the problem.