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?