How to fix the continues damage?

cousinehy

New member
I created an Enemy. Add a collider(trigger is on). Add a Damage script. Add health (deactivate the object if death)
When the character I created triggered by the Enemy, It will give damage to the character and it will show a damage visualization.
When the character was exit triggered by the enemy. no damaging effect and no damage visualization occur.

Here is the problem I need to fix.
While I received damage to the enemy and I killed it then the damage is still going on even I go in another place, remove the damage script in runtime.
 
OnTriggerEnter/Exit don't get called if the object is disabled, so if you're using OnTriggerEnter/Exit to determine when the enemy should damage the player, then if you manually disable the enemy object before exiting its trigger, it won't call OnTriggerExit to stop its attack behaviour.
 
I tried to call the method damage zone class to stop the schedule using the health event(death) Then it work.
 
I don't know exactly how you're triggering the enemy to damage the character, so could you paste the relevant snippets of code that you're using?
 
Instead of using the Damage zone script, I manually make a script to damage the character. Then it works. Thank you for the support
 
Top