Skip to Content
DocumentationFeaturesHit Effect

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.

Video

An enemy character being struck repeatedly, flashing bright white for roughly 0.15 seconds on each hit and decaying back to its lit appearance between blows.

features/hit-effect/hit-flash.mp4

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.

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

Inspector labelShader propertyTypeDefaultDescription
Hit Amount_HitEffectFloat (0–1)0.0Drives the flash. 0 = off, 1 = full tint.
Hit Color_HitColorColorRGB(1,1,1)Flash tint. White, red, or gold are typical.
Intensity_HitIntensityFloat (0–8)1.5HDR multiplier; push above 1 for bloom-driven punch.
Falloff Power_HitPowerFloat (0.1–8)2.0Higher gives a sharper attack and faster decay.
Hit Mask_HitMaskTexture2DwhiteOptional UV mask — flash only the body, not the eyes.
Fresnel Boost_HitFresnelBoostFloat (0–4)1.0Adds edge fresnel to the flash for silhouette punch.

Usage

  1. In your damage handler, get the renderer’s MaterialPropertyBlock.
  2. Set _HitEffect to 1 on hit.
  3. Animate it back to 0 over 0.1–0.2 seconds with DOTween, a coroutine, or Mathf.Lerp.
  4. 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.
Last updated on