public void despawnObjectWithID(int PoolNumber) { Spawned current = null; int row = PoolNumber / totalNrCopies; Debug.Log(PoolNumber + "<----------->" + row); foreach (Spawned i in spawned_SmallTrash[row].listObjects) { if (i.PoolNumber == PoolNumber) { current = i; break; } } current.gameObject.transform.position = transform.position; current.Interact(); current.gameObject.SetActive(false); spawnable_SmallTrash[row].Add(current); spawned_SmallTrash[row].Remove(current); }