Unity: Visualizing the player damage

Jake Boere
2 min readJun 8, 2021

Objective: We need to make it so that when the player takes damage we show them that they’ve been hit once and twice.

To start, we need to add the damage sprites as a child object of the player and then position it on top of the player’s right engine so that we have our first damage sprite set up.

Next set up the animation and after that duplicate the the sprite and change the position of the duplicated object onto the left engine.

Once both damaged engines are set up you you need to deactivate the object in the hierarchy by clicking the box beside the name in the inspector and be sure to do that for both game objects.

Now that the sprites are all set up we need to add the functionality in the player script. First, we need to make game object variables for both the left and right damage sprites.

Remember to serialize so we can add the game objects in the inspector.

Now we need to go to our damage method since the sprites need to show up when the player is damaged and add if statements for each different count of the lives we have. Inside the if statements we need to set the game objects to active so they show up once each time we are hit by an enemy.

--

--

Jake Boere

I am hard working Game development student learning as much about game development and unity as possible.