- Home /
Ontriggerenter not working
ok it is not really my trigger it is my tag it won't pickup that the player with that Player tag has hit it. here is the code.
pragma strict
var ZombieAtkDelay = 0.0;
function OnTriggerEnter(other : Collider) { if (ZombieAtkDelay > 0.5) { //it made it up to here if (other.tag == "Player") { Vitals.Health -= 5; ZombieAtkDelay = 0; } } }
function Start () {
}
function Update () { ZombieAtkDelay += Time.deltaTime; }
it passes the tag once but then stops but with my original zombie it would attack every 0.5 seconds
Answer by Youri1er · Aug 28, 2014 at 02:18 PM
I don't know if i understand your problem but if the trigger still in collision with the other collider or trigger, it's normal.
Because, you use OnTrigger*Enter . And this function like OnTriggerExit is execute only once per collison. Try to use OnCollisionStay* with a timer.
Your answer
Follow this Question
Related Questions
Problem with OnTriggerEnter 0 Answers
OnTriggerEnterProblem 1 Answer
Changing tagged objects in script 1 Answer
AI Attack Not Working! W/Video 1 Answer