gameObject.GetComponentsInChildren() as ParticleSystem[] returns 0

I am trying to destroy a game object and let its particles (of children) finish their last loop before destroying them.

void Update () {
	if (Input.GetKeyDown(KeyCode.A)) {
		Destroy(gameObject);
	}
}

void OnDestroy() {
	// Attempt 1 - one of the particle systems get left behind
	ParticleSystem [] particles = gameObject.GetComponentsInChildren < ParticleSystem > () as ParticleSystem[];
	Debug.Log (particles.Length); // FIXME: Why 0?
	foreach (ParticleSystem p in particles) {
		p.loop = false;
		p.Stop();
	}
	
	/* // Attempt 2 - disables my autodestruct script
	transform.FindChild("PS").particleSystem.Stop (true);
	*/
	
	transform.DetachChildren();
}

Unfortunately, they don’t stop emitting or they don’t get destroyed. The particle contains a self destruct script as follows:

void Update () {
	if (particleSystem.IsAlive()) return;
	
	Destroy(gameObject);
}

I don’t understand why GetComponentsInChildren() returns 0 length and why particleSystem.Stop() disables my scripts.

Thanks in advance!

[7326-particlesystemautodestruct.unitypackage.zip|7326]

EDIT: corrected line 9 to specify type of component to get from children.

I guess what you could do is try hiding the parent game object by disabling it’s renderer component. Then you could disable looping in the particle system by accessing particleSytem.mainModule.loop and setting it to equal false. To destroy the whole game object after the last loop has finished you could set a timer to destroy the game object after a certain number of seconds.