How to leverage the "Max Instances" field on events?

I was hoping EventInstance would handle this automatically, but I think we have to take care of this on our end? I want to have sounds play on top of each other up to the “Max Instances” count before restarting any of the currently-laying sounds

The Max Instances property of an event determines the maximum number of instances of that event that can be playing simultaneously. The means by which the number of playing instances is limited to this value, however, is determined by the event’s Stealing property.

If you want to prevent new instances of an event from being spawned when the number of playing instances is equal to the event’s Max Instances, set the event’s Stealing property to None. This stealing mode ensures that no new instances of the event can be created until the number of currently-playing instances drops below the event’s Max Instances property.

Incidentally, I should mention that the Max Instances property does not count event instances started from event instruments. Those must be limited by other means.

1 Like

Mega edit: My issue turned out to be I was caching a single EventInstance instead of calling EventDescription->creatInstance() on “play” triggers. From what I can tell, loading the EventDescription is the file read and instance creation is extremely fast. Also got one-shots working too, so I am happy!

Thanks

PS: The short answer is to make sure you are caching an event’s EventDescription and follow the “one shot” guidelines in the docs when you are spawning new instances of the event (aka avoiding memory leaks!).