How do you access the individual particles of a particle system?

I am trying to access the individual positions of the particles in a particle system. For example you can get a particle array from a newly created ParticleSystem by using this line. ParticleSystem.Particle[] emittedParticles = new ParticleSystem.Particle[this.particleSystem.particleCount]; But I am needing the get the particles for the ParticleSystem that is attached to the object that my script is attached to. But when I try to access the particle array like this `

//particleSystem is given the ParticleSystem component of the object that this script is attached to.

ParticleSystem.Particle emittedParticles = particleSystem.Particle[this.particleSystem.particleCount];`

I get an error because there is no particle array for me to access.
What can I do?

Your last line is incorrect. You set up the emitted particles array correctly using: ParticleSystem.Particle emittedParticles = new ParticleSystem.Particle[this.particleSystem.particleCount].
Then take the emittedParticles from that statement and then you must use:


After that you can modify each particle as needed but when you are finished you need to reset the array back to the particle system using

particleSystem.SetParticles(emittedParticles, emittedParticles.Length);