- Home /
Question by
Weither · Sep 22, 2013 at 01:22 PM ·
ontriggerenterzombiehp
Losing hp
Hi. I've got code:
void OnTriggerEnter(Collider other){
if(other.gameObject.CompareTag("zombie"))
{
currPlayerHealth = currPlayerHealth - 5;
}
}
And it doesn't work. Same when I make
void OnTriggerEnter(Collider other){
if(other.gameObject.CompareTag("bullet"))
{
currPlayerHealth = currPlayerHealth - 8;
}
}
I'm writing in C#.
Comment
Best Answer
Answer by meat5000 · Sep 22, 2013 at 01:24 PM
Have you tried using OnCollisionEnter instead?
If you don't want to use it, check the boxes labelled "Is Trigger" in the colliders.
Your answer
Follow this Question
Related Questions
Zombie Round Script Help 1 Answer
AnimationEvent, Collider, OnTriggerEnter logic? 0 Answers
Question about logical flow of a script 2 Answers
Attack Script 1 Answer