#Say I have various animations for death
1 messages · Page 1 of 1 (latest)
If its deleted early it looks bad obviously
Deleted?
My first instinct is to make such a particle system that it reliably finishes in a certain timeframe
yeah that would be "set a max and don't let any effects past that", probably most efficient but feels inelegant to me
and sets up a potential future problem
If you make an effect that never takes any longer than 2 seconds, you'll know that you can always pool it after two seconds, right?
That seems the most obvious solution to me
the problem is: in comes the intern, makes a longer effect then hours wasted working out why it dissapears
thats what I mean by creates a future problem
or just me in a month or two when I forget that all effects need to be under 2 seconds
Another option is to pool it when ParticleSystem.particleCount is 0 and expand the pool if no particle systems are available
But for optimization reasons you probably need to keep track of all this stuff anyway
oh this is interesting!
I can have it check at the end of what would be the duration and extend it if its not finished
by a set amount then check again
though that has a problem if there are any infinate particles, but that doesn't really happen right?
Definitely shouldn't happen
If the spawn particle systems have unknowably large particle counts active for an unknown amount of time, and the number of required spawns is unknown, that means you have no idea how much performance it will cost
I can't think of why a spawn or death particle effect should play continuously, but there's another option in that case
You could spawn the particles in world space and just move the particle system to a new position when pooling it instead of disabling it
But that's probably not useful in this situation
No it wouldn't normally so thats fine. if it does that is an error in the particle system not the code
and that should be found
by the animator basically
ok for now I think ill just go with a longer duration but that is something to keep in mind thanks
It's not the most elegant solution but I think still the best one is to keep track of both the required duration and maximum particle count when designing the effects
Not intern-safe, but then again what is? 😄
A similar problem would arise if you need to allow users to customize the effects, in case you do need some smart automatic system for it