So here’s my problem. I want to make an area that damages multiple units over time, only when more than one unit enters the trigger it still only damages one unit. Here’s my code
function OnTriggerStay (col : Collider) {
if (Time.time > lastDamage + damgeDelay) {
col.gameObject.BroadcastMessage(“ApplyDamage”, damage, SendMessageOptions.DontRequireReceiver);
lastDamage = Time.time;
}
}
If I remove the time check it damages all of the units, but on every physics frame, which I don’t really want.
Any ideas on how to fix this? Could I use an array and add/subtract items as they enter and leave from the trigger and just broadcast a message to all the items in the array?