Using OnCollisionEnter would solve all problems :D

I used OnCollisionEnter like this:

private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Enemy") 
            ||
            _rb.IsTouchingLayers(LayerMask.GetMask("Hazards")))
            Die();
    }

…and haven’t had any of the problems from the video, like not being able to die from the spikes or if you jump on top of the enemy. So I think it’s an easier and a more elegant solution than using bool isAlive, but nevertheless it was cool to see another way of handling player’s death :thinking:

1 Like

Privacy & Terms