Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Avascar on December 27, 2012, 03:07:19 AM

Title: Looping Music
Post by: Avascar on December 27, 2012, 03:07:19 AM
Hello everyone, I just would like to know how exactly to play a audio clip (music), set it at a specific volume (using a variable), and make it loop? I managed to play a audio clip and set it at a variable volume but it's not looping (used Play Audio). Any help? Thanks a bunch
Title: Re: Looping Music
Post by: kiriri on December 27, 2012, 06:33:14 AM
well, you could just loop the state with audio play itself :D It should have a Finished Event, which you can just loop back to the same state.
Title: Re: Looping Music
Post by: Avascar on December 27, 2012, 08:12:57 AM
Brilliant idea :D Thanks
Title: Re: Looping Music
Post by: Saputo on February 15, 2013, 10:45:38 AM
Iv tryed that with no dice, how would i go about doing this,the right way lol
Title: Re: Looping Music
Post by: kiriri on February 15, 2013, 01:35:22 PM
 :D Got me! I didn't notice it when I checked, but I must've replaced the PlaySound action with a custom one I made. +1 On the advice to always store altered and new actions in a custom folder   ::)

For now, try the action in the attachments, I've renamed it so it won't overwrite the original action. I'll have a look to see how to do this properly with the default actions now.
Title: Re: Looping Music
Post by: Saputo on February 15, 2013, 05:00:57 PM
K thank u I will give this a Shot right now
Title: Re: Looping Music
Post by: Saputo on February 15, 2013, 05:19:00 PM
LOL well I figured it out, Make a new Action, place the the Audio Play Action , set the Game Object to your Game Object, Set in your Clip, and Finished Event to Finished, ten add a Transaction to Finished, connect that to Start, then add a Audio Source to it, (if u didn't already), in the Inspector set your Audio Clip to the Same Clip, then check the box that says Loop, and your done.

Only problem i am having is a 0.5 second delay before it starts again.
Title: Re: Looping Music
Post by: kiriri on February 15, 2013, 05:26:25 PM
well, if you want to loop the music a finite number of times or if you want to loop sound that should normally not be looped, then there should be a better alternative imo. But the whole sound department seems to be rather weak in Unity I guess  :-\

Title: Re: Looping Music
Post by: Saputo on February 15, 2013, 05:44:57 PM
guess so, but it works for now till I find a better way, I just need it for the Main Menu's theme song,only other thing id need for the main menu is to have it play a sound or 2 at certain times