Damage Data

The DamageData struct encapsulates all the details of a damage instance. It is passed between systems like Hitbox, ProjectileAmmo, and Health.

Summary

This struct:

  • Holds the amount and position of damage
  • Tracks the instigator (e.g., shooter, attacker)
  • Supports fallbacks and validation

Fields

FieldTypeDescription
damagePointsfloatAmount of damage to apply.
hitPointVector3Position where the hit occurred.
hitNormalVector3Surface normal at the hit point (for physics or VFX).
instigatorGameObjectThe entity that caused the damage.

Static Members

MemberDescription
DamageData EmptyReturns an empty DamageData with all fields zero/null.
bool IsEmpty(DamageData damageData)Returns true if the DamageData is empty.

Constructors

ConstructorDescription
DamageData(DamageData data)Copies data from another instance.

Usage

Tip

Use this struct when applying damage from projectiles, raycasts, or melee hits.

Note

Add fields like damageType, critChance, or sourceWeapon if your system needs more context.

See Also