Sunday, April 3, 2016

Music in the Game via Unity #gamedev

Well today I wanted to get in some SFX and Music into Very Bunny Haha.

Oh oh, wait a minute. I should tell you why I feel I need to get some of the Audio into the game now.

Let's roll back to last Thursday evening. Where me and my family drove down to UCLA so we could watch a performance of Oklahoma by the Hooligan Theatre group. Starring in this performance is a neighbor of ours, who is such a lovely and talented young lady. Well her parents where there and we got to talking about stuff, and they also introduced me to another neighbor of ours, and he was really nice as well.

As it happens my neighbors are very talented musically, as one of them plays in an actual orchestra, and the other plays in a professional band overseas. I got to talking about things and they seem very interested in working on the game with me and Leilani. This could be awesome and so I want to get a better sample of the game being played with audio in it. Then I can demo the game to them and we can perhaps see what we can do for a collaboration!

Well now we roll forward to today and I am busy working on trying to get this Demo working.

Here I am though wondering quite how to set up my Music control for the game in Unity. I have created a Music Control script and I was initially going to add a public array to store all the audio (music) files and then drag all the music files to be used in the game into this array.

This method worries me a lot though.. wouldn't this simply load up front ALL my music tracks? This could easily eat many many MBs, and I do not want to have that happen when I get to tablets. So what to do?

My current theory is to store all the Music audio file names in an array instead and instantiate the music tracks I need when I need them. I am very hopeful that the one I am no longer playing will get cleaned up with garbage collection... but I am not confident.

I am not sure I have any other possibilities off the top of my head, and I only want to do this once, and of course efficiently. I think before I do any more actual coding I should read the Web and see what other people have written about this task.

G'night,
Da Voodoochief

No comments:

Post a Comment