playMaker

Author Topic: Looping Music  (Read 4902 times)

Avascar

  • Playmaker Newbie
  • *
  • Posts: 45
Looping Music
« 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

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Looping Music
« Reply #1 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.
Best,
Sven

Avascar

  • Playmaker Newbie
  • *
  • Posts: 45
Re: Looping Music
« Reply #2 on: December 27, 2012, 08:12:57 AM »
Brilliant idea :D Thanks

Saputo

  • Full Member
  • ***
  • Posts: 107
Re: Looping Music
« Reply #3 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

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Looping Music
« Reply #4 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.
« Last Edit: February 15, 2013, 01:40:13 PM by kiriri »
Best,
Sven

Saputo

  • Full Member
  • ***
  • Posts: 107
Re: Looping Music
« Reply #5 on: February 15, 2013, 05:00:57 PM »
K thank u I will give this a Shot right now

Saputo

  • Full Member
  • ***
  • Posts: 107
Re: Looping Music
« Reply #6 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.

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Looping Music
« Reply #7 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  :-\

Best,
Sven

Saputo

  • Full Member
  • ***
  • Posts: 107
Re: Looping Music
« Reply #8 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