I've just started working with Master Audio and have a question and pooled prefab objects. I notice that there is built in support for a few pooling systems but what is the best approach if an unsupported pooling system is used along with the EventSounds script?
For example, I have particle effects that are pooled using CFX SpawnSystem (as well as my own custom pooling system). These effect objects have an Event Sounds script on them. If I set the event to trigger on Start then it will only play once. If I set it to trigger on Enable then it will play as soon as the scene is loaded. The Unity Audio Source component works perfectly with this setup if you set Play on Awake to on.
The Unity Audio Source will not play the AudioClip when a pooled object respawns, only the first time.
But correct, Awake and Start events should not be used with pooled objects because that only happens the first time the objects is spawned, not with respawns. After that, it's just the object disabling and enabling itself. So, if you use Pool Manager or our pooling in Core GameKit (Pool Boss), you can use the Spawned event to trigger sounds or other Master Audio actions. Otherwise, there's no official support for other systems.
However, Enable may work, as long as you set the object to disabled when it's not emitting. If that doesn't work, I suggest you modify your custom pooling system to broadcast messages so that it will function just like Pool Manager. Add the following line of code right after you spawn an object assigned to the variable "pooledObject":