Thursday, November 12, 2020

Unity Tutorial 06

Screenshot of my unity tutorial

This week’s tutorials were particularly fun to complete. I learned how to add music, sound effects and particle effects in order to create a polished and complete game.

The process was more simple than expected. Essentially, for the particle effects I had to attach it to the game object. This would then appear in the hierarchy as a child object of the object it was attached to.  However, in order to control when and how the particle will played it needs to write code in the script for it, usually it is included in if-statements. First a public variable has to be made for the effect as it is not directly linked to the object like other components. Then it can be dragged into the box.

A little menu box appears where you get the chance to play, stop or restart the animation of the particle effect so you can see if you need to make any adjustments. There’s an overwhelming amount of options in the inspector menu of the particle effects where you can make different interesting changes such as the velocity or color of the effect.

To add music to a scene you attach an audio source component on the main camera. Then you attach the sound clip to that component. If the music runs out, there’s an option to loop it. For specific sound effects, they need to trigger in the code. You create a public variable using the AudioClip class where you add the soundclips in the player script component in Unity. Then similar to the particle effects you write a code in the if-statement to control when you want the sound effect to play.

Challenge 3 was a bit tricky for me. This is because when I looked at the line of code and compared it with what I had written during the tutorial I had to remember what some bits of the code represented. I should start to get into the habit of writing comments next to the code for reminders. That’s it for this week. I’m curious to see how much I’ll be able to implement when starting out to create my game.  See you then!

No comments:

Post a Comment

Doing

  We are nearing the end of this semester and the book we’ve been working throughout the semester is in its final editing stages. This week,...