Damage VFX using Animated Sprites in Unity
Objective: Learn how to set a damage VFX using animated sprites.
Now we are going to create the VFX that will show when the player is hurt.
First we are going to start with creating the effect that will be in the player.

After creating the effect, we are going to animate it, and afterwards we are going to duplicate the effect and place it on the other wing.

So with both wings created, we have the animation properly set on the player, when he is hurt. So we are going to turn both objects off, this way, we are only going to see such animations, when the player is hurt.

In order for us to properly activate these objects, we need to have them set up in our Player script, allowing us to attach these objects to it.
[SerializeField] private GameObject _leftWing, _rightWing;
Creating the variables for our wings objects. We set them as SerializeField so we can attach them properly in the Inspector.

Now that we have them properly set, we need to know when to activate them. How would we know this ? Well, we already have a method for taking damage, which is called when we are hit by an enemy. We can just add our logic inside this method, so when we are damaged, our wings start burning!
public void TakeDamage()
{
if (_isShieldOn)
{
DeactivateShield();
return;
}
_playerLives--;
if(_playerLives == 2)
_leftWing.SetActive(true);
else if(_playerLives == 1)
_rightWing.SetActive(true);
_uiManager.UpdateLivesDisplay(_playerLives);
if (_playerLives <= 0)
{
_spawnManager.StopSpawning();
Destroy(gameObject);
}
}
When taking damage, our player now will activate our burning wings effect, based on the amount of lives it currently has. When he is damaged the first time (player lives is 2), our left wing will be activated, and when damaged a second time (player lives is 1), our right wing also becomes active.

Now when our player is damaged, we can see the effects of the damage on our ship, showing us that we are burning!