NullReferenceException: Object reference not set to an instance of an object
EnemyBullet.OnTriggerEnter2D (UnityEngine.Collider2D other) (at Assets/Scripts/EnemyBullet.cs:28)
and if i remove the line 28, the bullet gets destroyed and the player is getting hit again.
the DamagePlayer() function is intended to lessen the player’s hp by 1.
Expect to see this error a LOT. It’s easily the most common thing to do when working. Learn how to fix it rapidly. It’s easy. See the above link for more tips.
This is the kind of mindset and thinking process you need to bring to this problem: