Damage effects in Unity using animated sprites

Samarth Dhroov
May 22, 2021

--

In this demo, the procedure to attach an animated damage effect to show up upon a collision within two collider objects is demonstrated.

  • Drag the damage sprite in the hierarchy, scale & place it as per choice and then make it a child of the game object where it should be displayed.
Unity
Unity
  • Follow the same steps and attach the second effect as well.
Unity
  • Declare two distinct damage variables as serialized and assign the game objects to them in the inspector.
// Damage Variable
[SerializeField]
private GameObject _rightDamage,_leftDamage;
Unity
  • The method that handles penalties should set these game objects to active.
C#
  • Animate the game object and assign the animation to both of them. Note that you’d have to add an animator component to attach an animation that is applied to some other object.
Unity

Here is the final result :)

Unity

Thank you very much

--

--

No responses yet