Question by
Yip37 · Dec 19, 2015 at 08:31 AM ·
collidertriggerontriggerenterontriggerexitenabled
How do I differentiate between the triggers?
So I have a ball. If it passes through one of the triggers, it has to do something, if it passes through the other one, it has to do another thing. I only know OnTriggerEnter/Exit but that does something when passing through whatever trigger.
Thanks.
Comment
Best Answer
Answer by Veerababu.g · Dec 19, 2015 at 09:48 AM
trigger enter and collision enter works only one whenever the collision or trigger enter.
if you want to do some along with trigger use
void OnTriggerStay(Collider other){
if(other.transform.tag=="1st"){
//do what stuff you need
}
if(other.transform.tag=="2nd"){
//do what stuff you need
} } collisionstay/trigger works each frame of collision
What I was needing was help with the tags, this helped, thanks!