Hook it into your game
Your game already decides who gets hurt, how much and when they die. Responsive FX only shows it. This page is about connecting the two without changing how your game works.
Pick one route #
| Your game has... | Use | Code? |
|---|---|---|
| A health script with a health number (a field or property) | Hit Feedback Bridge, Watch | None |
| A health script with UnityEvents (OnDamaged, OnHealthChanged, OnDied) | Hit Feedback Bridge, events | None |
| A place in code where damage is dealt | HitFeedback.Hit(target, amount) |
One line |
| No health at all yet | Responsive FX's Health component | None |
| Projectiles, hitboxes or traps but no damage code | The Hit On Contact recipe | None |
Use one route per enemy. Two routes (for example a Bridge watching your health and a call to HitFeedback.Hit in
your damage code) show every hit twice.
The Setup Wizard picks the route for you: under Who controls health?, Find it for me looks for your health script by name. When it finds one, it adds a Bridge that watches it. It never adds Responsive FX's Health next to your own.
The Existing Game preset #
Start with Existing Game (safe) when your game already has combat. It shows numbers, the flash, the bar, sound and sparks, and nothing else: no knockback, no squash, no hitstop, no camera shake, no slow motion, and the kill moment never hides or destroys your object. Your movement, physics, camera and time are never touched. Once that works, turn on the extras you want one at a time in the profile.
Hit Feedback Bridge #
Add Hit Feedback Bridge next to Hit Feedback (Add Component > Responsive FX).
Watch a value (no code). Press Find my health script, or drag your health script into Health script and pick its health value from the list (any float, int or double field or property). Optionally pick its max health value for the bar. Then every drop plays a hit, reaching Dead at or below plays the kill, a rise shows healing, and the bar follows the value. Coming back from zero (a respawn) shows nothing and tidies the object up. The Bridge only reads: it never changes your health. Reading it every frame makes no garbage.
Call it from your events. In your health script's UnityEvent press +, drag the object in and pick Hit Feedback Bridge and a method:
| Method | Use it for |
|---|---|
HealthChanged / HealthChangedInt |
Events that send the new health. Works out damage, heals and the kill. |
PlayDamage / PlayDamageInt |
Events that send the damage taken (a negative "changed by" amount works too). |
PlayCritical, PlayHeal, PlayShieldHit |
The other kinds. |
PlayKill / PlayKillNoNumber |
OnDied, OnKilled. |
PlayMiss, PlayBlock |
Dodges and blocks. |
SetAttacker, SetHitPoint |
Call just before a hit to give it a direction or a contact point. |
Test it (Play Mode). The Bridge inspector shows which route is in use, the current and max health, the last change and how many hits came from each route.
- Test Damage and Test Heal change your health value itself by Amount (fields and properties with a setter, kept between 0 and max), so the hit goes through exactly the route your game uses.
- Preview Critical, Preview Block, Preview Kill show the reaction and change nothing in your game.
- Last hit used defaults for lists what the last hit didn't know: no attacker (knockback pushes away from the
camera) or no hit point (numbers and sparks start at the target). Give them with
SetAttackerandSetHitPoint. - A warning appears when the same hit arrives twice (the value dropped and an event called the Bridge together): that shows two numbers, so use one route per object.
What watching can't know. A watched value only says it went down or up. Who hit, where, a critical (unless
Critical from is set), a block, a miss or shield damage need the event route or HitFeedback.Hit with a HitInfo.
Recipes #
Your own health script, in code #
public void TakeDamage(float amount, Vector3 point, Transform attacker)
{
hp -= amount;
HitFeedback.Hit(gameObject, new HitInfo(amount).At(point).By(attacker).Killing(hp <= 0));
}
Add IHealthSource to the same script (four properties, see Code, events and your own UI) and the
bars follow your health too.
Projectiles, 3D and 2D #
Put Hit On Contact (Recipes) on the bullet. It works with collisions and triggers in 3D and 2D, uses the exact contact point and the bullet's direction, and can destroy the bullet on its first hit. Turn on Feedback only when your own script deals the damage. From your own projectile code:
void OnCollisionEnter(Collision c)
{
HitFeedback.Hit(c.collider, new HitInfo(damage).At(c.GetContact(0).point).From(-c.relativeVelocity));
}
HitFeedback.Hit takes the collider you touched: it finds the Hit Feedback on it or on a parent, so hitting an arm
collider on a character works.
Melee hitboxes and trigger zones #
Hit On Contact on the hitbox. Each target is hit once per Once every seconds, so a hitbox that stays inside an enemy for several frames, or touches three of its colliders, gives one hit.
Hitscan weapons #
Call Hitscan Hit's Fire() (or FireShot from a UnityEvent). It casts a ray forward and plays the hit at the point
struck. Or in your own code: HitFeedback.Hit(rayHit.collider, new HitInfo(damage).At(rayHit.point).From(ray.direction)).
Visual Scripting #
Every Bridge method and HitFeedback.HitAmount, CriticalHit, HealAmount, KillingHit take one number, so they
show up as plain nodes. In a Script Graph, get the Hit Feedback (or Bridge) component and call the method with your
damage.
Pooled enemies #
Nothing to do: Hit Feedback puts the object back (colour, scale, frozen state) when it is disabled and enabled again.
If you reuse an object without disabling it, call hitFeedback.ResetVisual() when you respawn it.
Ragdolls #
The Setup Wizard spots ragdolls (three or more jointed bones) and turns off knockback and squash for them, because physics owns the body. The flash, numbers, bar, sound and sparks still play. Put Hit Feedback on the root; hits on any bone find it.
Many renderers, LODs and custom shaders #
The flash draws a copy of each renderer with Responsive FX's own shader, so it shows whatever your material is, custom shaders included, and never changes your materials. The copy is solid: it doesn't follow alpha cutouts, dissolves or vertex animation done in a shader. Only the first LOD flashes. To choose exactly what flashes (skip a weapon, a shadow blob or a VFX mesh), fill in Renderers on Hit Feedback.
Your own camera, Cinemachine and camera rigs #
Shake moves the camera a little after everything else and puts it back before your scripts run, so camera follow
scripts keep working. With Cinemachine 3, tick Use Cinemachine in the profile's shake to send impulses instead (your Cinemachine camera needs an Impulse Listener). When Camera.main is not
the camera players see (a rig, several cameras), add Hit Feedback Camera to the right one. Split screen with one
shake per player is not supported in 1.0.
Multiplayer #
Play feedback where it is seen: on every client, from the health value your network code already syncs. Watch that
value with the Bridge, or call bridge.HealthChanged(newValue) from your sync callback. Don't send feedback over the
network yourself, and don't play it on the server only.
ScriptableObject event channels #
Add a listener for your channel on the enemy and point its response at the Bridge's PlayDamage or HealthChanged.
Your TextMesh Pro font #
Add TextMesh Pro Numbers to any object in the scene and drag in your TMP font asset: numbers then use your font and material. See Damage numbers.
Big frameworks and character controllers #
Most combat frameworks have either a health value (use Watch) or damage and death events (use events). If their health lives in a system rather than a field, add a small script that listens to their event and calls the Bridge. Choose the Existing Game preset so knockback and hitstop don't fight their movement. We test against plain Unity components, not against each framework.
When nothing shows #
Open Tools > Responsive FX > Why No Feedback?. It lists every hit, says which effects played and why the others didn't, and names objects you hit that have no Hit Feedback. The Hit Feedback inspector also says whether your game has sent it any hits yet (Preview Hit doesn't count).