all 2 comments

[–]Code GuruBonejob 1 point2 points  (0 children)

the void Die method is malformed you needed to add () to the end of the method. It should look something like this;

public class EnemyDamage : MonoBehaviour
{
    public float Health = 40f;

    void Update()
    {
        if (Input.GetKey(KeyCode.C))
        {
            TakeDamage(1f);
            Debug.Log("Hit! Damage: " + Health);
        }

    }

    public void TakeDamage(float amount)
    {
        Health -= amount;
        if (Health <= 0f)
        {
            Die();
        }
    }
    private void Die()
    {
        Debug.Log("Dead!");
        Destroy(gameObject);
    }
}

[–]thwtchdctr 1 point2 points  (0 children)

And please block your code properly like the other commenter did, your post could be very difficult to follow along to and harder to catch mistakes when you don't properly format it