Day 57 With GDHQ: Creating a System To Switch The BGM
<p>One of the things I wanted to do, that wasn’t directly related to the boss’ behavior, was to have the BGM switch to something more intense when it spawns in.</p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:770/1*UbDrmXfWPlEhSaGmPhBs8A.png" style="height:168px; width:700px" /></p>
<p>Passing in the desired <strong>AudioSource</strong> and <strong>AudioClip</strong> allows this method to be used for any BGM switching that needs to happen.</p>
<p>Step one is to fade the current track out so that the switch isn’t so abrupt.</p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:662/1*fYl2rL9WhAzshtp6zDkH1w.png" style="height:187px; width:602px" /></p>
<p>After the current song is muted the AudioSource is stopped, switched to a different clip, and played again.</p>
<p><a href="https://medium.com/@nikolainelson/day-57-with-gdhq-creating-a-system-to-switch-the-bgm-81b212b07e6f"><strong>Learn More</strong></a></p>