Let’s go over how to add a blood splatter effect to enemies when they are shot.
I have previously shown how to set up the shooting in this article.
First, create or download the effect from the asset store:
Open up the PlayerShoot script. Add a serialized GameObject for the blood effect:
Update the Shoot function to check if you hit an enemy. If an enemy was hit instantiate the effect at point of impact. To prevent the effect from instantiating inside the enemy add the hit normal multiplied by 0.1 . The value of the hit normal is 1 so if did not multiply it by .1 the effect would show up one unit outside of the enemy. Use Quaternion.LookRotation to rotate the effect outwards:
Lastly, add the effect to the script on the inspector and ensure the tag is set on the enemy: