Adding Effects to our player

Creating an swing effect for our player attack animation

Now that we have our swing animation, we can spice it up by adding some visual effects during the animation sequence. We will be working on how to create an new animation state and working with the player Animation script to toggle the animation trigger.

Arc Effect Setup:

First we are going to import and slice the animation sheet into individual frames. Drag the first frame into the hierarchy and make the first frame a child of the player game object. Then we are going to create a new Animation for the Arc effect and dragging in all of the divided images into the dopesheet.

Next in the Animator window we need to create a new default state to prevent the sword arc effect to play immediately after launching the game. We need to create a new Trigger parameter to toggle the transition between the Idle and Sword Effect.

Player Animation script:

In the player animation script, just like how we have reference the animator in the sprite object, we need to do the same for the sword effect.

In the Start method, since both the sprite and the sword effect are children of the player object, we can’t use “Get component in children” anymore since there will be a confusion between the two game objects. Therefore in Unity, we can use an new type of identification. Since everything within the Hierarchy is based on a “hierarchy” we know that the first component is rated at Zero, and the next object starts at 1. Since the “Sword_Arc” component is second in the list, we can type out “Transform.Getchild(1)” before we get the component.

Finally during the attack phase, we can also implement the arc animation as well.

Now when you attack, there should be an sword effect that plays along with it.

--

--

--

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Complete idiot guide for building a dactyl manuform keyboard.

Handling OS Signals To Guarantee Graceful Degradation In Go

Outreachy : The complete process…!

Raiden Transport Explained

Building a real-time chat application with Laravel and Larasocket

Beaver Finance Weekly Report # 2

Cake v0.22.0 released

OpenVPN SplitTunneling on OpenWRT

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Simon Truong

Simon Truong

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.

More from Medium

Easy Way to Make an Audio Slider

Creating the Main Menu

Creating a Moving Platform in Unity

VFX — Adding player thrusters and visual player damage