When bullet hits
Fires when a bullet strikes a target, and it only detects objects carrying a Health component.
Introduction
When Bullet Hits is an event in the Ranged Weapon group of World Events. It fires when a bullet strikes a target, and it only detects objects carrying a Health component. Like every event, it does nothing by itself. It waits for the right moment, then runs all the actions connected to it. Use it for combat-grade hit feedback on things that can actually be hurt: enemies, crates, destructible walls. This event belongs to the Ranged Weapon component. Open the Ranged Weapon component guide to see everything the component itself can do. Every shot wants a result: this event reports each bullet that connects, following When Weapon Fires , and the lucky shots are flagged by When Critical Hit Happens . The damage it deals arrives in the health family through When Health Decreases , and bullet physics plus impact effects are tuned in the Ranged Weapon guide. When bullet hits event in the Uni editor Image The When bullet hits event in the Script Editor.
Parameters
Object the object the bullet hit Value the remaining health of the hit object Parameter Description
How to Access
How to Access - Event When bullet hits
How to Use
Select the ranged weapon in the right panel , then click its Propertie (the blue equalizer icon) and scroll to the bottom of the properties panel — the When Bullet Hits event is already listed there. Press the + button below the event to add a script, then press Edit on that script to open the script editor and build the actions that should run when the event fires. Press Play and shoot a target with the ranged weapon, then check that the actions run.
Example
When bullet hits: Set Self Ranged Weapon.Crit Multiplier Change To 0.01 when-bullet-hits-example.png Sets the weapon's crit multiplier to 0.01 whenever a bullet lands on a target. caption
Common Uses
Damage numbers and hit sparks on enemies Confirm-target-hit sound cues Combo tracking for accurate shooting
Tip
Only Health-bearing targets trigger this event; walls and dead props stay silent.