Problem with checking which object is selected

Hello my name is Pontus and im working on a chesslike game where you have alot of boxes which you can choose to click on and then make different structures/characters appear on that box.

this is what i’ve got right now:

var SelectedObject : GameObject;

function OnMouseDown(){
SelectedObject=this.gameObject;
}

I want all other boxes to get unselected when i click a box, so i can only select one box at a time. I dont really know how to do this, also i just want to use one script for all of my boxes!
Help is very much appreciated!

I would propose that you save all the boxes in a 2d array and represent the selected object with a vector2.
So you would have access to all your objects when needed.