public void OnEnter(TriggerVolume trigger, Collider2D collision) { MyPlayer myPlayer = collision.GetComponent <MyPlayer>(); if (myPlayer != null) { myPlayer.Die(); } }