Checking total number of particles in a scene
How to check the number of particles i have in the scene at any frame? I am trying to make a graph showing relationship between fps and total number of particles across multiple particle emitters.
Comment
Best Answer
Answer by danivdwerf · Oct 18, 2016 at 07:40 AM
Hey man,
I find the API for particle systems pretty dumb, here's a way of doing it:
private ParticleSystem ps;
void Start ()
{
ps=GetComponent<ParticleSystem>();
}
void Update()
{
ParticleSystem.Particle[] particles=new ParticleSystem.Particle[ps.particleCount];
int num = ps.GetParticles (particles);
Debug.Log (num + "Particles Found");
}
Good Luck!
Thanks for the help but what exactly is "ps" in this code ?
whoops, let me change the code real quick, it's just the particle system