Creating Managers Part 2

The Audio and UI Managers

Audio Manager

Setup

I created The Audio Manager as a Singleton. It needs an Audio Source to play Voice Overs and an Audio Source to play the back ground music. I also include a default clip to use for the music to play in the background. I created a Method to play the voice over as a one shot. I then create a Method that plays the back ground music looping. Before playing the Background music I make sure that there is no other music already playing.

I then assign the need values in the Inspector.

Using The Audio Manager

The First Place that I want to use the Audio Manager is in the cutscene game event listener. I want to be able to assign music that will play in the background when cut scenes play. For example the Start cut scene has a different background music to play. Once the cutscene is complete make sure that the default background music is played.

The only One that I do not have different background music to play is the sleeping guard cutscene. I assigned all the rest of them values. By leaving the Sleeping Guards Empty it will play the default music.

The Other place that I want to use this is for the voice over triggers. Currently The triggers trigger a game event. On the Dialogue Audio Source Object I have a Unity Event Listener that Plays the Audio Clip. I am going to remove all of the Unity Event Listeners here and create a Voice Over Trigger to use.

The Voice Over Trigger I do similar to the Game Event Trigger. Instead of triggering a Game Event I Use the Audio Manager to Play the Voice Over Clip.

I add the Voice Over Trigger to the Voice Over Triggers in the Scene. I then Assign the Audio Clips to Play.

UI Manager

Setup

Just like the Game Manager and Audio Manager I created an Empty Game Object with The UI Manager Component.

I created a Singleton Behavior, Do not forget the Disallow Multiple Component

I created a method to Restart the level. Using the Screen Manager to Load the Current Active Screen. I Created A Method to quit the Application. Application.Quite Does not work in the Editor or for Web GL Builds, for the Editor I Used The Editor Is Playing, and for the Web GL Build I Opened my website.

I then used the Restart and Quit Methods of the UI Manager for the Restart and Quit Buttons in my cut scenes.

The UI Buttons Now Work.

--

--

--

Excited about changing my hobby into a new carer with GameDevHQ course.

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

Recommended from Medium

Part 1: It’s cloudy out there for SMBs

5 Tips for Creating a Great App Interface Design

Approaching a Redesign

Art101.io Round One NFT collections now listed and rarity ranked with RankNFT.io

Art101 Logo

The level 3 of UI/UX design: find the extraordinary UI/UX for your next big app design.

New landing pages in ConvertKit! See how creators can grow their list in the next 11 minutes.

Ux is a designing story

What designers should do

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
James Lafritz

James Lafritz

Excited about changing my hobby into a new carer with GameDevHQ course.

More from Medium

Adding a player ammo indicator to the UI

2.5D Platformer: Level Design Update

2D Mobile: Designing Enemies Using Abstract Classes

Easy Way to Make an Audio Slider