- Home /
Question by
MonkeyAssassin8 · Feb 15, 2012 at 02:25 AM ·
triggerobjectsmultipleon
OnTrigger events on multiple objects
I'm having trouble getting an OnTrigger event to work with multiple collisions, whether it be another player or object also in the trigger. Here's my code, I've tried putting it on the trigger and on each player, but it only affects one object:
void OnTriggerStay(Collider other1){
if(timer > 0)
timer -= Time.deltaTime;
if(timer <= 0){
ApplyDamage(-1);
timer = cooldown;
}
}
This is only the function, not all of the variables are included. Everything else works, but the trigger is only working for one object.
Comment
Answer by Berenger · Feb 15, 2012 at 03:30 AM
Make sure your collisions have each at least one non-kinematic rigidbody involved.
Your answer
Follow this Question
Related Questions
GetComponent in Multiple Children 1 Answer
how to make my camera follow multiple children of objects? 0 Answers
Can't get more than one object. 1 Answer
OnTrigger/Collision 1 Answer
Changing current audio on trigger. 1 Answer