Game Dev in Progress… Day 6
Hello and welcome back to another installment of Game Dev in Progress!!! I’m your host Cristian Aspacio and today we’re going to be looking at Sound and Animations in Unity!!! I wrote a little bit about animating in Unity on my last post but today were going to talk about the things that I was able to do with it and my impressions on it. Oh and I’ll talk about sound later on.
Last time, I talked about how you can just drag your sprite images and create an animation on the fly. But this time I learned how to apply logic to it so that these animations we’ll play when certain events happen. When we create an animation, we also not only make that animation but its controller as well. This controller can be attached to an Animator component allowing that object to play that animation. In order to create a controller, you can just drag and drop an animation to the appropriate object in your hierarchy. So how do we apply logic to the animation? By using the Animator.
The Animator can be opened up by clicking Window > Animation >Animator. This window we’ll show us the different events that animation goes through. I noticed that animating is really easy in this because we can just create different states in order to stop, play, or even play a different animation. The window helps manage all this states and reminds me of a state machine. With the animator window, you can add different events which can be called in your code using the Animator API. There is a lot of cool methods but the one that I used today was the SetTrigger(). This will play the animation when I call this trigger.
Next up, I finished going through the sound section today. There was a lot of cool things but one problem that I had was playing the audio when I destroy the object. I had to come up with creative solutions to this such as delaying the objects destruction so that my audio clip would have time to play. I also learned the power of using the Post Processing Package. This package made my game look like an actual game at the click of a few buttons on the Unity Editor.
Overall, this day has been very informative. It also made me appreciate all the artists out there that make all the different assets and make games so wonderful to look at. The animation section taught me how really hard it is to animate as well create all the logic with animation without creating a visual bug. That is it from me, have a great day!!!
_
Cristian Aspacio