PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

Lifetime

ParticleEmitter

NumberRange

The Lifetime property defines the maximum and minimum ages a newly emit particle will. When a particle is emit, a random lifetime is chosen uniformly. Lifetimes are stored on a per-particle basis, so if this value is changed, existing particles will stay “alive” until their randomly chosen lifetime is lived. The bounds for this property should be in the range [0, 20]. By default, ParticleEmitters will have a lifetime of 5 to 10 seconds. A lifetime of 0 will prevent particles from being emit in the first place.

it is important to pick a sensible Lifetime and ParticleEmitter/Rate so that you don’t have too many particles being rendered at once. Long lifetimes and high emission rates are a quick way to cause performance issues. If you need many particles, pick a balance of lifetime and rate. To instantly remove any presently emit particles (perhaps ones with absurdly long lifetimes), you can call ParticleEmitter/Clear.


Code Samples


Creating a Particle Emitter from Scratch

This rather lengthy code sample shows how every property of a ParticleEmitter can be set, including DataType/NumberRange, DataType/NumberSequence and DataType/ColorSequence properties. Below is how the ParticleEmitter should after every property is set. Try playing around with the different properties to customize how the effect looks!

The final product