|
Post by TFG on Dec 13, 2019 22:44:33 GMT
Hi there. Great asset!
I am making a game that requires very precise sound playback, so I’m scheduling sounds using MasterAudio.PlaySound with the dspTime argument. However, occasionally I need to stop a scheduled sound from playing. I can roll out a script for this, but is there a way in-framework to handle unscheduling sounds?
From the API docs it does not look like you can do it though the PlaySoundResult returned object and I don’t see anything else that applies.
|
|
|
Post by DarkTonic Dev on Dec 14, 2019 0:22:08 GMT
Yeah you should be able to stop the scheduled sound just the same as a playing sound, like this:
var psr = MasterAudio.PlaySound3DAtTransform("arrow", transform, 1f, 0f, 0, "", 4); if (psr.ActingVariation != null) { psr.ActingVariation.Stop(); }
The Stop method of SoundGroupVariation stops the Audio Source, which should take care of scheduled things as well. Let me know if it doesn't work.
|
|
|
Post by TFG on Dec 14, 2019 0:51:13 GMT
That works. Thanks a bunch!
|
|
|
Post by DarkTonic Dev on Dec 14, 2019 1:05:29 GMT
No problem!
|
|