My Logic Board is Fried!

Happy New Year all! Is it too much booze? Or what is wrong with my logic???

I have a GUI code that controls the color of an instantiated prefab with buttons.

var arrowToggle = false;
var arrow : GameObject;
static var selectionGridColors : int = 0;

function OnGUI(){
	var hit : RaycastHit;
	var ray = camera.main.ScreenPointToRay (Input.mousePosition);
	
	//ARROWS
	arrowToggle = GUI.Toggle (Rect(2, 2, 36, 36), arrowToggle, "AR", "button");
	if (arrowToggle) {
		//start extra GUI        
        selectionGridColors = GUI.SelectionGrid(Rect(Screen.width - 212,2,210,30),selectionGridColors, swatches, 7);          
		//finish extra GUI 
        if (Input.GetMouseButtonDown(0)){        
        if (Physics.Raycast (ray, hit)){
        if(hit.collider.gameObject.tag.Contains("collider")) {
        Instantiate (arrow, hit.point + (hit.normal * 0.1), Quaternion.FromToRotation (Vector3.up, hit.normal));       
                }
            }
        }
    }
}

On each instance of the arrow a code looks for changes in the GUI through exposed static variable in the GUI code. It also has a static variable telling other instances of the arrow if it is thisArrow that is being “focused on”.

However when I click on the arrow to select it, the arrow takes on the color of the previous arrow I changed the color of before I can change it through the GUI. My question is, if I have already changed the color, how do I keep that color until I want to change it again, and not inherit it from the previous? Hope that makes sense. Thanks

static var thisArrow : GameObject = null;

function OnMouseDown () { 
    	thisArrow = gameObject;
}

function LateUpdate () {
   if (gameObject == thisArrow) {
    
    	switch(GUIControl.selectionGridColors){
		case 0:	    
			renderer.material.color = Color.black;
			break;
		case 1:
			renderer.material.color = Color.blue;
			break;
		case 2:
			renderer.material.color = Color.cyan;
			break;
		case 3:
			renderer.material.color = Color.green;
			break;
		case 4:
			renderer.material.color = Color.yellow;
			break;
		case 5:
			renderer.material.color = Color.red;
			break;
		case 6:
			renderer.material.color = Color.magenta;
			break;				
    }
  }
}

Okay, I think I know what the problem may be. The selectionGrid stays selected to the color which was selected last. So when I click on an arrow it takes on the color which is already selected in the Grid. So maybe the button should be clicked and then automatically deselected?

The problem with that is if I want to instantiate lots of arrows of the same color, I have to click on the button each time?

Huh??? No… It’s only an issue when I re-select the arrow prefab, then it needs to retain the color with which it was instantiated until I change it through the GUI.