private void OnCollisionEnter2D(Collision2D collision) { ItemComponent item = collision.gameObject.GetComponent <ItemComponent>(); if (item != null) { item.PickedUp(); } }