Hit Effect
Hit Effect is the white flash on damage seen in countless action games. Genesis exposes it as a single material property you drive from your damage system: push it to 1.0 on hit and the shader handles the falloff curve internally.
A curve-driven white flash firing on each damage event.
When to use it
- Enemy damage feedback — flash white or red on hit.
- Player damage — tint a screen-edge HUD prop.
- Healing and buffs — flash green or gold.
- Critical hits — push intensity above 1.0 for a brighter punch.
Drive via MaterialPropertyBlock
How it works
The shader lerps the lit color toward _HitColor by _HitEffect, multiplied by an internal pulse curve pow(_HitEffect, _HitPower). The expected pattern is to set _HitEffect to 1 on hit and animate it back to 0 over 0.1–0.2 seconds.
Properties
Usage
- In your damage handler, get the renderer’s MaterialPropertyBlock.
- Set
_HitEffectto 1 on hit. - Animate it back to 0 over 0.1–0.2 seconds with DOTween, a coroutine, or
Mathf.Lerp. - Apply the block back to the renderer.
var mpb = new MaterialPropertyBlock();
renderer.GetPropertyBlock(mpb);
mpb.SetFloat("_HitEffect", 1f);
mpb.SetColor("_HitColor", Color.red);
renderer.SetPropertyBlock(mpb);
// Schedule a coroutine that lerps _HitEffect back to 0 over 0.15s.Tips & gotchas
- Use a MaterialPropertyBlock rather than
material.SetFloat, or every enemy sharing the material flashes too. - A duration of 0.1–0.2 seconds is the snappy sweet spot; slower reads as damage over time.
- Stack with Hue Shift for buff and debuff cues — a green pulse plus a hue shift sells healing.
- Cost is one lerp plus a pow, so it is effectively free.
Related
- Emission — pushes the HDR flash into Bloom.
- Hologram — combine for sci-fi damage feedback.
- Effects API — the damage-flash helper.
- Color Adjustments — global desaturate when low on health.
Last updated on