There was already some audio attached to the game and game objects but there are a lot more still to be imported and applied. I decided to have a go at importing a SFX clip myself. I decided to import the wind gust sounds. There was already a wind blowing noise in the background but I wanted a specific noise for the wind gusts to indicate that they were on-screen and available for use. I wanted the audio clip to play for as long as the wind gust was on screen.
I felt that it was important to have a separate audio clip for when the wind gust is on-screen as this will add to the experience of the player actually flying a kite. As it turned out it was not that difficult, but that’s only because of the work I have put in with my two games and now knowing where to look when I want to script something.
I first downloaded the audio clip from freesound.org which was created by thearxx08 and then created a new folder in the Wind with the Wind folder called Imported. I cut and pasted the audio clip into the folder and then switched back to Unity and waited for the import to be recognized.
I then opened the Sound Controller script and added the following lines so that the inspector would allow me to allocate the sound file.
public void Windgusts ()
I then opened the Wind gusts script and added lines 10, 18 and 19.
Finally in the Inspector with the Wind Gust prefab selected I dragged and added the audio clip so it added an Audio Source component.
After all that was done when the game was run, the wind gust sound only played when they were on-screen, which added nicely to the effect of flying a kite out in the wind.
Well that is it for this one. Thank you for your interest and time, it is much appreciated. Until next time….
God bless you.