Hello,
when playing a sound, as I understand it, Defold notifies the initiating gameobject when the playing is done by a) calling an optional callback funtion and b) sending a “sound_done” message:
sound.play( url, props, function( self, message_id, message, sender )
-- sound has ended.... do things
end )
Often, I have the case that an initiating object does not need this information. In fact, when I have e.g. a bullet gameobject initiating a sound on impacting its target, the bullet has already been deleted when the sound is done playing. In that case, I get an error message which I would like to avoid:
ERROR:GAMEOBJECT: Instance '/instance12' could not be found when dispatching message 'sound_done' sent from playground:/instance12#sound
I would have thought that just the fact of providing a callback function would already prevent that message sending? After all, such a function will always take care of any action required upon the sound ending and an additional message being passed seems useless - but apparently, the “sound_done” is always sent?
Is there a way when playing sounds to prevent Defold from sending “sound_done” when I do not need / want it?