Hi,
I am trying to run some functions only to the “just born” particles.
Below is my trial but do I have any better ways?
ParticleSystem.Particle[] ps = new ParticleSystem.Particle[sys.maxParticles];
int count = sys.GetParticles(ps);
for (int i = 0; i < count; i++)
{
if (ps<em>.remainingLifetime < ps_.startLifetime * 0.99f)_</em>
{
some functions
}
}
thanks!
I’d do
if(ps_.startLifeTime - ps*.lifeTime < Time.deltaTime)*_
Then you’re only checking (hopefully) what was created in the last frame.
There doesn’t appear to be any callback to see if a single particle was emitted (probably too much risk of overhead).
What are you trying to accomplish? There may be a better way.
I am sample a texture with position and emitting particle from the position.
So I need to have the color to be applied when it is born.
I ended up actually Emitting particle from script so it has the color in ParticleParam. I guess it works for now.