private void OnCollisionEnter2D(Collision2D collision) { GameObject go = collision.gameObject; EnemyShot es = go.GetComponent <EnemyShot>(); if (es) { if (es.isAlive == true) { es.DoDamageToShot(3); if (es.isAlive == false) { mainPlayer.ScoreIncrease(1); } } } Destroy(gameObject, 0.2f); }