How Do I Drag And drop GUITextures From Set Positions?

I simply want to be able to loot an enemy and have the looted item go to a default position in the inventory.

If the default position is taken, then I want the item to go to the position next to the default one.

And so on.

So far, I have an inventory system. In this script I have assigned a spot for each item:

var items : List.;
var spaces : List.;

var itemCount : int;

function Awake () {

   spaces.Add(Rect(279, 225, 66, 63));
   spaces.Add(Rect(344, 225, 66, 63));
   spaces.Add(Rect(409, 225, 66, 63));
   
   spaces.Add(Rect(279, 160, 66, 63));
   spaces.Add(Rect(344, 160, 66, 63));
   spaces.Add(Rect(409, 160, 66, 63));
   
   spaces.Add(Rect(279, 96, 66, 63));
   spaces.Add(Rect(344, 96, 66, 63));
   spaces.Add(Rect(409, 96, 66, 63));
   
   spaces.Add(Rect(279, 32, 66, 63));
   spaces.Add(Rect(344, 32, 66, 63));
   spaces.Add(Rect(409, 32, 66, 63));

}

function Update () {

   itemCount = items.Count;
   
for (var item in items) {
               
   (item as GameObject).transform.position = Vector3(0, 0, 1);
   
for (var i = 0; i < itemCount; i++) {

   item = items*;*
 _(item as GameObject).guiTexture.pixelInset = spaces*;*_
_*}*_
_*}*_
_*}*_
_*
*_

But because I have set the position of the item I can’t move it to another spot, any Ideas on how to correct this?
Or:
Anyone know how to drag and drop an item to another location?
Thank you for your time!

Instead of using a fixed mapping for your items, you could use a map object (Dictionary in C#) to assign slots to items. This way you could say that you want item 0 to be in slot 3 and so on.

For dragging and dropping I would use the mouse down and up events to see where to move the icon to. I am sorry, I do not have any examples or tutorials, but if you search for it, you might find an example implementation.