mush
New Member
Posts: 39
Posts: 39
|
Post by mush on Jan 15, 2015 10:07:03 GMT
I have a sound toggle option for the user which works great at muting all sounds in my game.
I have also made a music toggle option but how do I get the wave music to mute?
The music only starts when the first wave is triggered and I really like this effect.
|
|
|
Post by DarkTonic Dev on Jan 15, 2015 23:50:50 GMT
You can add the following code to WaveMusicChanger.cs
public static void MuteMusic() { if (statAudio.clip != null && statAudio.isPlaying) { statAudio.mute = true; } } public static void UnmuteMusic() { if (statAudio.clip != null && statAudio.isPlaying) { statAudio.mute = false; } }
Then call them from your script. These additions will be in the next update.
|
|
mush
New Member
Posts: 39
Posts: 39
|
Post by mush on Jan 16, 2015 20:02:57 GMT
Thanks for the quick reply - I can call these now no problem but the music keeps playing.
|
|
|
Post by DarkTonic Dev on Jan 16, 2015 23:23:14 GMT
No idea why, they work for me.
You'll need to send me an example project that reproduces the problem.
|
|
mush
New Member
Posts: 39
Posts: 39
|
Post by mush on Apr 8, 2015 17:45:27 GMT
Yep i can confirm that WaveMusicChanger.MuteMusic() and WaveMusicChanger.UnmuteMusic() work perfect now thank you.
How can I loop the music so that it plays more than once?
|
|
|
Post by DarkTonic Dev on Apr 9, 2015 6:02:22 GMT
Find the Audio Source that's on the same game object as the WaveMusicChanger script and turn on the "loop" checkbox.
|
|
mush
New Member
Posts: 39
Posts: 39
|
Post by mush on Apr 9, 2015 9:10:15 GMT
Thanks that worked so easy 
|
|
|
Post by DarkTonic Dev on Apr 9, 2015 15:20:47 GMT
No problem!
|
|