playMaker

Author Topic: How to Stop Random Sound ?  (Read 1979 times)

akaiwinter

  • Playmaker Newbie
  • *
  • Posts: 1
How to Stop Random Sound ?
« on: October 16, 2014, 06:36:44 AM »
Hi

I want to do this :
click an abject , then a random sound start to play .
AND , when the object get clicked for the second time/more , during the current sound's play time , THIS sound stop to play , and we use random sound again.

I don't know how to stop the sound.
my main idea is this :
(object that we click : sphere )


so I don't know what should I do in this sate (kill the last sound)


I used this :

and put an audio source to the sphere . coz I wanted to use [audio stop]


I know it doesn't make sense to use [audio stop] like that , I wanted only show what I want .


so what should I do ?


p.s : its about a month that I use unity and playmaker.
so please explain it some how that I can understand . thanks a lot : D

TheBadFeeling

  • Junior Playmaker
  • **
  • Posts: 66
Re: How to Stop Random Sound ?
« Reply #1 on: October 16, 2014, 07:54:01 AM »
When playing your sound, are you using One Shot Clip? Don't.
Instead, line the sound up to be played inside the audio component of the object, and then start it afterwards. That way you can stop it again.

So, in other words:
1. Set the sound in a Set Audio Clip action.
2. Play the sound with an Audio Play action (leave One shot clip empty, it already knows what to play)
3. Stop the playing sound with Audio Stop.
The Force is with you, young Playmaker – but you are not a C# senpai yet.