How can i disable a call temporaly?

I made this:

public void RestarVida()
    {
        vidaActual--;

        
    }

And then i made a boolean that call “invulnerabilty” when the player hit a collider, how can i disable the call “RestarVida” when the boolean “Invulnerability” is on true?

@DaniGLara, Where ever you do call RestarVida(), do this instead:

if( ! Invulnerability ) RestarVida();

That said, you not need RestarVida() at all if that is the only code in it - it’s a waste of processing time and code. Simply delete the entire function and do this instead:

 if( ! Invulnerability ) vidaActual--;