The music within Iron Realms was not made in house, so to speak, but was gathered via external sources. Implementing the music into Iron Realms was however done in house.
There are 5 music tracks in Iron Realms: 3 over world tracks for the Hamlet, the Ruins and the general travel over world and 2 tracks for combat; 1 for basic enemies and another for the boss battle.
I created an empty game object which was a child of the main camera and attached all 5 audio tracks to that empty game object.
I then selected Window > Audio Mixer to bring up the Audio Mixer tab next to the Console and Project tabs. Here I created 5 snapshots, the snapshots allowed me to adjust the volume of each track and save them as specific instances to be referenced later; there was one for each track in the game and the main difference between each snapshot was that all other tracks, other than the track that the snapshot focused on, were muted.
Within Unity I made a c# script that followed the naming conventions laid out by Prem throughout the project, specifically this script was going to manage the music within the game so I named it m_MusicManager.
Within said script I added using UnityEngine Audio; and made public audio mixer snapshots. These would allow me to assign each snapshot to be called within the script.
The music faded in and out with trigger boxes and to check which snapshots should fade in and when I added tags to each trigger box that would present a new track within the game; for example there is a large trigger box around the Hamlet which is tagged "HamletZone" and within the script and the if statements I made when the player collides with the trigger box tagged as "HamletZone" the referenced audio snapshot would fade in to play.
No comments:
Post a Comment