private void OnCollisionEnter2D(Collision2D collision) { Player _player = collision.collider.GetComponent <Player>(); if (_player != null) { _player.DamagePlayer(enemyStats.damage); DamageEnemy(100); } Cow _cow = collision.collider.GetComponent <Cow>(); if (_cow != null) { _cow.DamageCow(enemyStats.damage); DamageEnemy(100); } }