Saltmire Hitbox 2D – Combat Damage System
Drop-in Hitbox2D and Hurtbox2D for Unity 2D: teams, knockback, i-frames, crits and damage resistances, with zero collision-layer setup.
by Saltmire
Price History +
Your hitbox turns on right on top of the enemy — and nothing happens.
Every 2D dev hits this one. OnTriggerEnter2D only fires when a collider enters. If your attack activates while it is already overlapping the target, the hit is silently lost. So you start patching: manual overlap calls, a layer matrix nobody remembers, and a list to stop the same enemy taking damage every physics frame.
Saltmire Hitbox is that whole layer, already solved.
Add Hitbox2D to your attack and Hurtbox2D to whatever can be hurt. Give them different teams — that is the entire setup, with no collision matrix to maintain. Call Activate() when the swing starts and it also catches targets that are already overlapping, so the hit never goes missing.
HONEST ABOUT SCOPE
This is a focused runtime layer, not a full combat framework. There is no health bar, no enemy AI and no weapon inventory — on purpose. It does hit detection and damage delivery, does it correctly, and stays out of your way. Three clean, commented scripts you can read in one sitting, wired to whatever health and feedback systems your game already has.
TESTED, NOT JUST WRITTEN
Ships with 7 PlayMode tests covering every rule it claims: hits between different teams, same-team immunity, one hit per swing, critical multipliers, resistances, and hits correctly swallowed by invincibility frames. Open the Test Runner and verify the behaviour yourself before you trust it in your game.