A lightweight, modular, and fully functional 2D health and damage system for Unity.Perfect for platformers, action games, or prototypes, this package gives you working scripts, prefabs, and a demo scene — no polished graphics required.FeaturesModular Health SystemTrack HP for players or enemiesSupports events for damage and deathDamageDealer2D ScriptSingle-hit or repeated damage zonesOptional knockback for dynamic effectsLayer and tag filtering for precise targetingPlayer Movement ScriptSmooth horizontal movement and jumpingEasily integrates with knockbackHealth UIScreen-space HUD or world-space floating barsAuto-update and optional fade-in/fade-outPrefabs & Demo ScenePlayer and enemy prefabs ready to drop inDemo scene showcasing movement, damage, knockback, and health barsWhy Choose This AssetScript-only, functional, and lightweight — no extra art or clutterEasy to integrate into any 2D projectExpandable — all systems are modular and customizableRequirementsUnity 2021.3 or laterWorks with 2D project templatesNo external assets neededIncluded in PackageScripts: Health.cs, DamageDealer2D.cs, PlayerMovement2D.cs, HealthUI.csPrefabs: player, enemy, health barDemo scene: simple environment to showcase features✅ Perfect for prototyping or adding a ready-made 2D health system to your game.Key Features1. DamageDealer2D (Damage System)Multiple Damage Types: Physical, Fire, Ice, Poison, Other.Customizable Damage Amount: Set per object via inspector.Target Filtering:By LayerMask (allow/ignore specific layers)By TagOption to ignore self and parent/child objectsSingle-Hit or Continuous Damage:Single hit option (one-time damage per target)Repeated damage while staying in trigger with configurable interval.Knockback Support:Applies 2D force to Rigidbody2D on hitCustomizable force vectorProjectile/Hit Object Options:Destroy object after hitting target (useful for projectiles)Event-Driven Design:onHit (triggered when target is damaged)onKill (triggered when target dies)Hit Tracking: Prevents multiple hits on same target if singleHit is enabled.2. Health (Health Management System)Health Settings:Configurable max healthOption to destroy object on deathDamage Handling:Reduces health by given damage amountOptional invincibility duration after taking damageHealing System:Restores health by a specified amountFull health reset functionKill Function: Instantly sets health to 0 and triggers deathEvent System:OnDamaged → current/max healthOnHealed → current/max healthOnHealthChanged → any health updateOnDeath → death event triggeredInvincibility Management: Handles cooldown after damage to prevent repeated hits3. HealthBarUI (UI Integration)Dynamic Health Bar: Updates an Image.fillAmount based on current health.Automatic Binding: Works with the Health component on the same GameObject.Event-Driven Updates: Listens to OnDamaged and OnHealed to update UI in real-time.Debug Support: Logs health changes for easier testing.Other Features & HighlightsFully modular: Each component works independently, allowing easy integration with different game objects.Unity Events: Highly flexible, works without coding for designers via the inspector.2D-Ready: Designed for 2D physics, but easily adaptable to 3D with minor changes.Clean and configurable: Inspector-based configuration with tooltips for every field.




