Oh, that was really quick
!
That’s the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyHealth : MonoBehaviour
{
[SerializeField] int maxHitPoints = 5;
[SerializeField] int currentHitPoints = 0;
void Start()
{
currentHitPoints = maxHitPoints;
}
void OnParticleCollision(GameObject other)
{
ProcessHit();
}
void ProcessHit()
{
currentHitPoints--;
if(currentHitPoints <= 0)
Destroy(gameObject);
}
}
Once I play run, and according to the lesson video, I should see Current Hit Points going from 5 to 0. Instead, it always shows 0.

Again, the code does what it’s supposed to do, but it doesn’t show this “debugging” clue.