public void TakeItem() { GameObject player = GameObject.FindGameObjectWithTag("Player"); MenuController menuC = player.GetComponent <MenuController> (); PlayerInventory inv = player.GetComponent <PlayerInventory> (); if (inv.AbleToAdd()) { inv.AddItem((GameObject)items [menuC.index]); menuC.RemoveFromCurrentNode(); items.RemoveAt(menuC.index); if (items.Count == 0) { gameObject.GetComponent <TileInfo> ().SetToNormalTile(); } } }