using UnityEngine;
using System.Collections;
public class damager : MonoBehaviour
{
public int hitsNeeded = 8;
public int hitsTaken;
void OnTriggerEnter(Collider c)
{
if (c.GetComponent<Collider>().tag == "Enemy")
hitsTaken += 1;
Debug.Log("a collision occured, hitsTaken:" + hitsTaken);
if (hitsTaken >= hitsNeeded)
Destroy(gameObject);
}
}
Ok, so what's your problem here? What doesn't work? What have you actually tried? This code should work in theory depending on how you setup your scene.
– Casiell