Unity 2D - Making a hitbox damage a for just once.
This is for a 2D game.
I have a character with a sub-GameObject called hitbox. The component is deactivated by default. It gets activated in certain keyframe of the animation attack, and deactivated in the following keyframe.
When the hitbox is activated, if in touch with the foe's hurtbox, it lowers the foe's health by 1 point.
The problem I have is that between the keyframe that activates the hitbox and the one that deactivates it, several game frames are executed, so it ends up losing more than 1 health point.
How could I address this issue?
Answer by OctoMan · Oct 08, 2015 at 01:40 PM
Why not use a collider for this and only decrease health in OnTriggerEnter? This would fix your problem.
Your answer
Follow this Question
Related Questions
Cool hurt animation 1 Answer
How can i kill my enemy?,How to kill enemy in unity 3d. 1 Answer
Damage not working properly 1 Answer
GUI Texture slide down || Clipping mask. 0 Answers
Touch control swipe up to jump 1 Answer