My Player keeps loosing 2 lives

i dont know why, but my Player keeps loosing2 lives. Need help pls…

void OnTriggerEnter2D(Collider2D col)
{
if (col.gameObject.CompareTag(“Player”))
{
Destroy(gameObject);
LifeTextScript.LifeAmount -= 1;
PlayerMovement.hurt = true;
Debug.Log(“LooseLife”);
if (LifeTextScript.LifeAmount < 1)
{
SceneManager.LoadScene(“GameOver”);
}
}
else if (col.gameObject.CompareTag(“Bullet”))
{
Destroy(gameObject);
}
}

destoryed gameobject influence lifeAmount

use boolean to make it once, like

bool isDamaged;

void onTriggerEnter(col Collider)
    if(col.compareTag)
        isDamaged = true

void fixedUpdate()
  if(isDamaged)
    isDamaged = false;
     life--;
     Invoke or Coroutine ( that blinking invincibility function);
1 Like