Blood effect when HIT
- Add a prefab that holds the particle system to your (player) object.
- Disable the prefab.
- 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;
- Add next line in the TageDamage function.
StartCoroutine(ShowBlood());
- Add the new function.
private IEnumerator ShowBlood()
{
BloodPrefab.SetActive(true);
yield return new WaitForSeconds(1.0f);
BloodPrefab.SetActive(false);
}
- Drag the prefab into the empty field.