public void AddToInventory(Item newItem, GameObject obj) { if (inventory.CurrentInventory.Contains(newItem)) { return; } if (inventory.CurrentInventory.Count >= inventory.InventoryCap) { return; } inventory.CurrentInventory.Add(newItem); switch (GetComponent <Transform>().tag) { case "P1": objectList.Add(newItem.ItemType.ToString() + P1.GetNumberItems(newItem.ItemType), obj); break; case "P2": objectList1.Add(newItem.ItemType.ToString() + P2.GetNumberItems(newItem.ItemType), obj); break; case "P3": objectList2.Add(newItem.ItemType.ToString() + P3.GetNumberItems(newItem.ItemType), obj); break; case "P4": objectList3.Add(newItem.ItemType.ToString() + P4.GetNumberItems(newItem.ItemType), obj); break; default: break; } }