removing item from list?

Edit: Figured it out, Nevermind!

    private void Start()
    {
        questItemList = new List<string>();
        inventoryList = new List<ItemData>();
    }

    public void AddItem(ItemData itemData)
    {
        inventoryList.Add(itemData);
        Debug.Log(itemData.itemName);
        return;
    }

    public void RemoveItem(ItemData itemData)
    {
        inventoryList.Remove(itemData);
        Debug.Log(itemData.itemName);
    }

So i have a list of itemData with a couple of functions so i can add or remove items, which i use this script on a ui button to do so:

public class GiveItem : MonoBehaviour
{
    public string itemNameToTake;
    public ItemData itemToGive;

    public void GivePlayerItem()
    {
        PlayerDataManager.instance.AddItem(itemToGive);
    }

    public void TakePlayerItem()
    {
            PlayerDataManager.instance.RemoveItem(itemToGive);
    }

}

adding the items is working but removing the items isn’t. Any idea why?

It’s always a good idea to post the solution / mistake you found.
That way others with a similar problem, who happen to find this thread in the future, can see if it’s their problem as well.

the solution is to make sure to add the same exact script to both buttons event functions