How to implement the OnDestroy method for gpu particles?

Hi everyone,
I’m studying how to implement the OnDestroy method for gpu particles.
At first, my idea was to maintain the particle’s alive flag entirely by myself, and call the custom OnDestroy function when this flag was set to false by me.
But I found a fatal flaw: if the emitter is destroyed directly on the cpu, the gpu particle’s OnDestroy function will not be called.
Does anyone have a better way to achieve it?