Wouldn’t it be more clean and generalized to have selfdestruct.cs keep track of the explosion particle systems and if they stopped playing destroy them? This way the selfdestruct script can be put on the “Spawn at runtime” game object and it will keep itself clean no matter what particle systems are playing under it + for different animations with different end times:
void Update()
{
foreach(ParticleSystem vfx in this.GetComponentsInChildren<ParticleSystem>()) {
if(vfx.isStopped)
{
Destroy(vfx.gameObject);
}
}
}
or is this an expensive operation to do as update() each frame?