private void OnCollisionEnter2D(Collision2D collision) { MainCharacter mainCh = collision.collider.GetComponent <MainCharacter>(); if (mainCh != null) { mainCh.Damage(); } }