• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Output message Audio_PlaySound Attempting to play sound on inactive emitter

MeltingCat

Member
I've been getting game freezes lately a lot and didn't know what to look for as I'm not getting an error message. I've realized now that this message shows in the output, possibly just before it freezes.
The thing is, I'm using a deactivation code deactivating objects far outside view. But I thought that this code would also prevent any of those objects running any code that plays a sound from its emitter. So this doesn't make sense to me. There is no code in any object trying to play sound from a different object's emitter, so I don't know what to look for.
Any ideas what kind of issue this could be?
Grateful for any tips.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
You could try adding in breakpoints to all the places where a sound is being played from an emitter then run the game in debug mode and see which one gives the error.This would help you to narrow down the issue to a specific object or script. It's probably worth noting that instance deactivation takes a step to be completed, which might also be an issue. By that I mean, deactivation works like this:

1) You call deactivation.
2) The instance is taken off the internal active instances list BUT still isn't on the inactive instance list (it's in a kind of "limbo" state)
3) The current step ends
4) the deactivated instance is added into the inactive instance list at the start of the next step

So, if you have a call to a sound to play on an emitter somewhere in between the deactivation of the instance and the end of the step, it could be that this is giving you the error, as the instance isn't technically active any more, but still present within the room and not yet on the inactive instance list. If this is the case, you'll want to think about the activation/deativation routines and probably want to move them into the end step event so that all the game code runs correctly before anything is actually deactivated.
 

MeltingCat

Member
Thanks a lot for your answer.
I wasn't aware of these details of how deactivation works, so that's really helpful to know.
I've moved all the deactivation to the end step event and haven't gotten any crashes since, fingers crossed that that is the fix, as the crashes were quite irregular and unpredictable.
Thanks again for helping!
 
Top