Code Examples
This function leverages the SurfaceManager to spawn an effect that corresponds to the hit surface type (e.g. grass, dirt etc.)
if (Physics.Raycast(ray, out RaycastHit hitInfo, m_MaxDistance, m_RayMask, QueryTriggerInteraction.Ignore))
{
// effect type
SurfaceEffects effectType = SurfaceEffects.BulletHit;
// audio volume multiplier
float audioVolume = 1f;
// useful for parenting decals to moving targets
bool shouldParentEffect = false;
SurfaceManager.SpawnEffect(hitInfo, effectType, audioVolume, shouldParentEffect);
}