Allow to pass index of sound, by default play first sound currently requires a string to be passed ( the name of the sound slot ).

I wanted a generic way to just play the first sound attached to the sound. If the user renamed the sound ( which they are taught to do with all assets, to make them more meaningful ), then just doing this doesn’t work.“Slot 1”);

It would be great if allowed for an index, so this would work…;

…and to extend that further, have use by default the first sound slot, if it exists.

For anyone looking for an alternative solution, the code below works to play the first[0]);

This could be a case where, if many users might only attach a sound to an object with one sound clip, having the ability to just call to play that one sound would make life a bit easier.

I’m just flagging this again as a useful and sensible default bahaviour.

If someone does, detect that the first parameter is undefined and just play the first sound attached - with a check to see if there is a sound there of course :slight_smile: - as this is very likely what a new, and experienced, dev would want most of the time.

1 Like

It’s not an unreasonable request :thinking: