|
Post by danosono on Aug 12, 2022 22:30:11 GMT
Hello,
I want to play a short sound when a GameObject is set active IF a bool is true; this will only play once.
I could use Event Sounds > Start or Enable, but I don't know how to add a condition.
I could use Event Sounds > Code-Triggered Event, but I cannot figure out how and I don't know if I need to.
Any help is appreciated.
Danny
|
|
|
Post by danosono on Aug 13, 2022 11:40:53 GMT
[Solved] Found it (for others with same question); this allows to play a sound under any conditions (in code) that you like. If you need to trigger any Sound Groups during times other than those provided by the included scripts, you can use the following line of code: MasterAudio.PlaySound(string soundGroupName, float volumePercentage, float? pitch, float delaySoundTime, string variationName); www.dtdevtools.com/docs/masteraudio/TriggeringAudioCoding.htm
|
|
|
Post by DarkTonic Dev on Aug 13, 2022 15:36:00 GMT
Correct, you will need to use code. That will work. You should use MasterAudio.PlaySoundAndForget if you don't need the return value. That will not allocate or cause garbage collection later.
|
|