Ammunition damage
Give ammunition independent damage values and read them from hit events.
Assign an optional BulletDamageProfile to a bullet asset to define gameplay damage independently of its physical mass, velocity, energy or drag.
Create and assign a profile
- Choose Create → RSB → Bullet Damage Profile in the Project window.
- Name the asset and set Base Damage to a non-negative number of damage points.
- Select your
BulletPropertiesasset and assign it under Gameplay Damage → Damage Profile.
For example, create FMJ Damage with 25 points and Hollow Point Damage with 40, then assign each profile to its corresponding bullet asset. These numbers are arbitrary game-balance values. Multiple bullet assets can share a profile; selecting a physical bullet preset or changing its display units does not change the assigned profile.
Existing bullet assets have no profile assigned and keep their existing behavior. A null profile means no damage settings were supplied. A profile with Base Damage 0 is an explicitly configured zero-damage profile.
Read damage on a target
Attach this TargetHitListener.cs to a target root. It receives global events, filters them to colliders on that target or its children, and reads the damage value. Replace the final log with a call to your own health system.
using IE.RSB;
using UnityEngine;
public sealed class TargetHitListener : MonoBehaviour
{
private void OnEnable()
{
SniperAndBallisticsSystem.EAnyHit += OnHit;
}
private void OnDisable()
{
SniperAndBallisticsSystem.EAnyHit -= OnHit;
}
private void OnHit(BulletPoint point)
{
Collider hitCollider = point.m_hitCollider;
if (hitCollider == null || !hitCollider.transform.IsChildOf(transform))
return;
// Do not apply damage again as the bullet leaves this surface.
if (point.m_hitType == BulletPoint.PointHitType.PenetrationOut)
return;
BulletDamageProfile profile = point.m_properties != null
? point.m_properties.DamageProfile
: null;
if (profile == null)
return;
float damage = profile.BaseDamage;
Debug.Log($"Shot {point.m_shotId}: {damage} damage to {name}", this);
// Pass damage and point.m_shooter to your health system here.
}
}Skipping penetration exits avoids the usual entry/exit double application. A bullet may still produce additional impacts through ricochets or multiple hitboxes. If your game wants one damage application per target per shot, define that policy using m_shotId and the receiving target. RSB does not automatically deduplicate these events.
What the value means
BaseDamage is configuration, not an automatically applied or physically derived damage result. Your game handles health, armor, body-part multipliers and falloff. Assigning a profile does not change penetration, simulate hollow-point expansion, or change the demo enemy's immediate ragdoll response.
Profiles are shared ScriptableObjects, not per-shot snapshots. Treat them as configuration during play; editing one affects every bullet referencing it, including bullets in flight. For additional game-specific metadata, derive from BulletDamageProfile and assign the derived asset to the same slot.
See BulletDamageProfile, BulletProperties and BulletPoint for the API.