Journal 145 — Unity Project Development, 2.5D Shooter

Objective: To fix the Main Menu and Game scenes and set up Audio

In the previous articles, I got the UI and mid-level boss and final boss working. I want to fix the Main Menu screen and also set up some sound effects and background music.

Main Menu

I’ll start with a new scene that contains a UI Canvas with a background image and some UI buttons for Start, Options, and Quit Game. The Options button will bring up a sub-menu to be able to modify the audio level and brightness level.

I’ll add a new C# script called MainMenu and attach it to the UI Canvas. We’ll need to add functions to set the Options menu active and inactive, quit the application, and load the game scene. Once these are set up, we can update the UI buttons with OnClick() events.

Also, be sure to update the Build Settings now that there’s a Menu scene and Game scene.

We can update the OnClick() events in the inspector by dragging the Canvas with the MainMenu script, and selecting the correct functions to load the game scene, Options menu, or quit application.

In the Options menu when set active, we need to update the Back button to turn the Options menu back to inactive.

Now, let’s see this in action.

Audio

Let’s add an empty game object called Audio Manager. I’ll add a background object and just play a looping track I found on freesound.org.

Then, I will pick out some weapon sounds for gunfire and missiles, vehicle sounds for the plane and helicopter movement, collectibles, and explosions.

Player Weapons

On the Player game object, I will add an Audio Source component. In the Player script, I’ll make an audio array to switch out the gunfire sounds to the weapon levels whenever the weapon is triggered in Update.

In the Inspector, I’ll add three sound clips I found in some Unity Asset packs.

Collectibles and Destroy

For the collectibles, I will add a script to the Audio Manager, and I will create a singleton and use functions to play the collectible pickup sounds and also play sound when a player or enemy is destroyed.

In the Enemy script, I will call the audio clip when destroyed.

In the power up script, I will play sounds when the OnTriggerEnter event is called.

Thank you for your time!

For the next article, I plan to work on some post processing effects and more polishing of my game.

--

--

--

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

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

Recommended from Medium

JVM Architecture JVM is only a specification, and its implementation is different from vendor to…

How To Fix Meizu E3 Not Charging [Troubleshooting Guide]

Hearing is Believing

Let a Thousand Flowers Bloom

This Week In TurtleCoin (July 16, 2019)

How I Learned About Contributing to Open Source Projects By Creating One

Python Basics: Files and Operations

Outside Rehearsals for Acting Classes? via /r/acting https://t.co/Ipp9ztif1M

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
Chris Nielsen

Chris Nielsen

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

More from Medium

Journal 142 — Unity Project Development, 2.5D Shooter

Unity Animation Event Explained

A Series On Creating Immersive Audio in Unity with Custom Wwise Scripts

Moving Platforms in Unity