I sort of know why this happens, but don’t know how to fix it. The player has a collider which is trigger to activate the end of the scene when he exits the area, but because he is the trigger, when I give him the death script for when the enemy walks into him, he automatically activates it. How can I fix this? I’ve tried it by putting the script on the enemy and it still doesn’t work. Any help will be appreciated
You need to check for the different colliding objects.
A common way to do that is to tag the enemies as something like “Enemy”
then in your function:
function OnTriggerEnter(other : Collider){
if(other.Tag == "Enemy"){
//kill player
}
else{
//do something else
}
}
That’s what your issue sounds like to me.