Problem my list add the same object when drag

Hi, I have a problem when drag the object in various slots… The name of object are diferents but when drag in slot the item the name of object is the same when add a list for others and i don’t know this happen.
this is my code:

public class Inventory : MonoBehaviour, IHasChanged {
    [SerializeField] Transform slots;
    public List<GameObject> itemLists;
    
// Use this for initialization
    void Start () {
        HasChanged();
    }
       

    public void HasChanged(){      
   
        foreach (Transform item in slots) {
            itemLists.Add (item.gameObject);
                Debug.Log (itemLists.Count);
    
}
}
}

@Xremix30

TBH I don’t understand what you are trying to say.

I see no drag and drop related code here - and isn’t this third similar thread already?

What are you actually doing? What is the context? Are you trying to create some inventory UI or something else? Are you following some tutorial? That IHasChanged interface makes me think so.

Maybe try to explain in detail what you are trying to do.

I am creating a game in which when the player drags like arrows from one inventory to another he needs to save that base in a list so that afterwards they can be executed at once by clicking on a button to make the robot move in the directions that main data. I already have the drag and drop all done my problem is even when I drag the objects (images) from one inventory to the other I need these to be saved in the list for later in the button class I call there for when to play it read the list and make the robot move if the sequence is given. This Inventory class is found on the canvas and I think that only in this class is the problem. In the hasChanged () function I have a for going through the slots where you will receive the object that is dragged, but whenever I drag an object, the name we give it when it is created is the same for everyone is the o if all the items in the inventory had the same name when added to the list. I based myself on a YouTube tutorial that teaches you how to do drag and drop.