Callback Events continuing to play after Unity crashed

Hi everyone,

I just implemented a callback event using this example script
I feel like this callback might have caused some performance problems, though I am not sure. Is this possible?
Also, my unity editor crashed my computer (as it does) and when it restarted, the unity editor was gone but the event was playing in a very short loop. This is probably due to the fact that memory was pinned by hand, which is usually taken care of when the OnDestroy() function is called.
Of course, that doesn’t happen when the editor/computer crashes, so yeah. It freaked me out a bit, is there any way of avoiding this?
The concept of hand-pinning memory is new to me, so please excuse the noob questions :slight_smile:
I restarted the computer again and the issue was gone, but i’d like to know if i can do any harm to my computer like this.

MacBook Pro 2019 running Big Sur
2.4 GHz 8-Core Intel Core i9
Radeon Pro Vega 20 4 GB

Thanks a bunch!

I doubt it. Callbacks are not particularly memory-intensive - though I suppose of the code that handles the callback requires a lot of resources, you might have issues.

Have you tried removing the callback, to see if it measurably affects your performance?

Unfortunately, without knowing anything about the specific crash you encountered, there’s no way for us to know how or why this happened. We’re not aware of anything that could cause an audio loop to continue playing after a machine reboots itself, even when using manually-pinned memory.