Jump to content

Sound plays anyways after setPlayOnEnabled(false)


photo

Recommended Posts

We have a few sounds for which we create sound sources immediately after spawning the object but don't play them directly. I would expect that calling setPlayOnEnable(false) would prevent them from playing, but apparently it does not as with the following code the sound plays anyway:

	SoundSource sound = new SoundSource("Boom.wav", 0);
	sound.setPlayOnEnable(false);
	sound.setMinDistance(1.f);
	sound.setMaxDistance(75.f);
	sound.setLoop(true);

I tested it on both 2.11 and 2.13 beta 2 and it happens on both versions. Is this intended behaviour and are we having the wrong expectations from this function, or a bug? In older versions of Unigine the default behaviour was for sounds to not start automatically but I can't find anything in the changelogs about this behaviour changing.

Link to comment

Bemined

Play on Enabled option is basically the "rewind and play" analogue, so it doesn't affect sound source behavior on creation. It's also very useful in the cases when you need to spawn a a previously disabled node (for example, explosion).

For your use-case you may need to call sound.stop() after the SoundSource creation (if you don't want to play it immediately).

Could you please check if that would work?

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...