ParticleSystem.GetParticles, returns 0 after emit?

Any tips for how to use getParticles properly…?

Just trying to get the particles in Start()…

but if I try this, the count returns 0,
then if I put the print() inside Update(), it prints 500…

public var particleObject:GameObject; // this gameobject has shuriken system
public var  maxParticles:int = 500;
private var _ParticleSystem:ParticleSystem;
private var particles : ParticleSystem.Particle[];

function Start () 
{
	// create particle array (do I need to set the size manually..? looks like so..)
	particles = new ParticleSystem.Particle[maxParticles];
	// get particle system
	_ParticleSystem = particleObject.GetComponent(ParticleSystem);
	// emit some particles, this works
	_ParticleSystem.Emit(maxParticles);
	// get those particles..
	var count:int = _ParticleSystem.GetParticles(particles);
	print (count);  // returns 0
}

Shuriken is updated between Update and LateUpdate. So you have to wait one to get the correct particle count. I am not sure if you could also use _ParticleSystem.Simulate (…).

thanks, that worked!

added this line after emit:

_ParticleSystem.Simulate(0.1);

This can be slow though. It is actually a bug that it doesn’t Emit immediately. It’s fixed already and will be in a future version.

That was unexpected! I had to use that in my Cloud System and though it should be like that :-).