Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
370 B
4
Indexable
Never
private void OnCollisionEnter2D(Collision2D collision)
{
    Debug.Log("Colliding");
    if (collision.gameObject.tag == "Player")
    {
        Debug.Log("Colling with player");
        if (playerHealth == null)
        {
            playerHealth = collision.gameObject.GetComponent<Health>();
        }
        playerHealth.TakeDamage(damageLevel);
    }
}
Leave a Comment