The ParticleSystem class in Unity allows you to create visually complex and dynamic simulations like fire, smoke, or a flock of birds. From sparks flying in a firefight to the delicate dust particles in a sunbeam, particle systems bring a game to life.
At its core, a ParticleSystem shoots out particles in a certain direction and for a certain duration, but there's much more to it than that. You can control over a wide range of properties like the color, size, and shape of the particles, the speed and direction of their emission, and their behavior over their lifetime.
Want to have physics applied to your particles or intricate collisions? That's possible too. Given its scalability and rich feature set, ParticleSystem is a powerful tool for adding atmospheric and stylistic flair to your game.
To understand how to use ParticleSystem to its full potential, refer to Unity's ParticleSystem Documentation.
Properties
The 'has3DParticleRotations' property tells you if any particles in the ParticleSystem have 3D rotations. Useful for optimizing processing when 3D rotations are not needed. Unity's ParticleSystem.has3DParticleRotations Documentation
The 'hasNonUniformParticleSizes' property indicates whether the ParticleSystem contains particles of non-uniform sizes. When true, this could influence specific rendering techniques. Unity's ParticleSystem.hasNonUniformParticleSizes Documentation
The 'isEmitting' property helps you to determine if the ParticleSystem is currently emitting particles. This can be particularly useful for performance optimization. Unity's ParticleSystem.isEmitting Documentation
The 'isPaused' property signifies whether the ParticleSystem is currently paused or not. This can give you finer control over the game flow based on the ParticleSystem's state. Unity's ParticleSystem.isPaused Documentation
The 'isPlaying' property tells you if the ParticleSystem is currently playing. It's helpful to alter behavior based on the state of the ParticleSystem. Unity's ParticleSystem.isPlaying Documentation
The 'isStopped' property indicates whether the ParticleSystem has been stopped, thereby not emitting particles. It's ideal for enabling/disabling other game features based on ParticleSystem's activity. Unity's ParticleSystem.isStopped Documentation
The 'particleCount' property provides the current number of particles in the ParticleSystem, which is useful for performance tuning and diagnostics. Unity's ParticleSystem.particleCount Documentation
The 'proceduralSimulationSupported' property indicates whether procedural simulation is supported on the ParticleSystem. If supported, you can manipulate the ParticleSystem without the overhead of enabling it. Unity's ParticleSystem.proceduralSimulationSupported Documentation
The 'randomSeed' property allows you to seed the random number generator for reproducible effects. This can be beneficial for creating predictable visual effects. Unity's ParticleSystem.randomSeed Documentation
The 'time' property returns how long the ParticleSystem has been playing. It's particularly useful when you need to trigger events based on the playback time of your ParticleSystem. Unity's ParticleSystem.time Documentation
The 'totalTime' property reflects the total lifetime of the ParticleSystem in seconds. It's beneficial for initiating actions once the ParticleSystem has ended. Unity's ParticleSystem.totalTime Documentation
The 'useAutoRandomSeed' property, when set to true, lets Unity automatically generate a random seed allowing different effect each time. Unity's ParticleSystem.useAutoRandomSeed Documentation
Methods
The 'Clear' method removes all particles in the ParticleSystem. It's a handy way to reset the ParticleSystem to an empty state. Unity's ParticleSystem.Clear Documentation
Returns
The 'Clear' method removes all particles in the ParticleSystem. It's a handy way to reset the ParticleSystem to an empty state. Unity's ParticleSystem.Clear Documentation
Parameters
withChildren
Should the clear request include all child systems?
Returns
The 'Emit' method allows you to create new particles, emits the specified amount instantly. Useful to create a burst of particles at a particular time. Unity's ParticleSystem.Emit Documentation
Parameters
count
The number of particles to emit.
Returns
The 'IsAlive' method lets you know if the ParticleSystem is still alive, meaning if it is still emitting particles or any of its particles are still alive. Allows for decision-making based on ParticleSystem's state of activity. Unity's ParticleSystem.IsAlive Documentation
Returns
Returns true if the ParticleSystem is still alive.
The 'IsAlive' method lets you know if the ParticleSystem is still alive, meaning if it is still emitting particles or any of its particles are still alive. Allows for decision-making based on ParticleSystem's state of activity. Unity's ParticleSystem.IsAlive Documentation
Parameters
withChildren
Should the check include all child systems?
Returns
Returns true if the ParticleSystem is still alive.
The 'Pause' method halts the simulation of the ParticleSystem in its current state. It can be resumed later using the Play method. Unity's ParticleSystem.Pause Documentation
Returns
The 'Pause' method halts the simulation of the ParticleSystem in its current state. It can be resumed later using the Play method. Unity's ParticleSystem.Pause Documentation
Parameters
withChildren
Should the pause request apply to all child systems?
Returns
To restart the ParticleSystem or resume it after a pause, use the 'Play' method. It includes an optional parameter to include all child systems. Unity's ParticleSystem.Play Documentation
Returns
To restart the ParticleSystem or resume it after a pause, use the 'Play' method. It includes an optional parameter to include all child systems. Unity's ParticleSystem.Play Documentation
Parameters
withChildren
Should the play request be propagated to all child systems?
Returns
The 'Simulate' method advances the simulation of the ParticleSystem by the given number of seconds. It's particularly useful when creating effects that happen instantly, rather than over time. Unity's ParticleSystem.Simulate Documentation
Parameters
t
The number of seconds to advance the ParticleSystem simulation by.
Returns
The 'Simulate' method advances the simulation of the ParticleSystem by the given number of seconds. It's particularly useful when creating effects that happen instantly, rather than over time. Unity's ParticleSystem.Simulate Documentation
Parameters
t
The number of seconds to advance the ParticleSystem simulation by.
withChildren
Should the simulation include all children of this ParticleSystem?
Returns
The 'Simulate' method advances the simulation of the ParticleSystem by the given number of seconds. It's particularly useful when creating effects that happen instantly, rather than over time. Unity's ParticleSystem.Simulate Documentation
Parameters
t
The number of seconds to advance the ParticleSystem simulation by.
withChildren
Should the simulation include all children of this ParticleSystem?
restart
Should the ParticleSystem be restarted before the simulation is run?
Returns
The 'Simulate' method advances the simulation of the ParticleSystem by the given number of seconds. It's particularly useful when creating effects that happen instantly, rather than over time. Unity's ParticleSystem.Simulate Documentation
Parameters
t
The number of seconds to advance the ParticleSystem simulation by.
withChildren
Should the simulation include all children of this ParticleSystem?
restart
Should the ParticleSystem be restarted before the simulation is run?
fixedTimeStep
Should Unity simulate each individual time step for the full duration of 't'?
Returns
The 'Stop' method halts the emission of particles, providing the option to stop instantaneously or let live particles die out naturally. Extremely helpful in controlling the lifecycle of particle emissions. Unity's ParticleSystem.Stop Documentation
Returns
The 'Stop' method halts the emission of particles, providing the option to stop instantaneously or let live particles die out naturally. Extremely helpful in controlling the lifecycle of particle emissions. Unity's ParticleSystem.Stop Documentation
Parameters
withChildren
Should the method affect all children of this ParticleSystem?
Returns
The 'TriggerSubEmitter' method triggers all sub-emitters on this ParticleSystem, which means it starts their emission. Sub-Emitter allows to spawn new particles based on the state or behaviour of a particle in the parent system. Unity's ParticleSystem.TriggerSubEmitter Documentation
Parameters
subEmitterIndex
The index of the sub-emitter in the ParticleSystem's sub-emitters list.
Returns
Updated 9 days ago