I have several colliders in place, and one of them loads the next level and another one trigger the enemy’s attack sequence. But when the player enter the Enemy’s Collider, it loads the next level instead. How do I specify which collider does what?
In a script on the gameobject “player”, you have to check which GameObject’s collider you just triggered, like so:
OnTriggerEnter (Collider other) {
if (other.gameobject.name.isEqual("enemy") {
//attack
}
else if (other.gameObject.name.isEqual("doorToNextLevel) {
//load next level
}
}