Blood effect when HIT

Script

Size: 0.98 KB

You need to login to download this file.

  1. Add a prefab that holds the particle system to your (player) object.
  2. Disable the prefab.
  3. Add the following code to the "Target.cs" script from the dead animation tutorial. Or use the version here above and add it to your (player) object.
public GameObject BloodPrefab;
  1. Add next line in the TageDamage function. 
StartCoroutine(ShowBlood());
  1. Add the new function.
private IEnumerator ShowBlood()
{
  BloodPrefab.SetActive(true);
  
  yield return new WaitForSeconds(1.0f);

  BloodPrefab.SetActive(false);
}
  1. Drag the prefab into the empty field.

recommended