• Studio

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • ParticleSystem

    Inherits from: Component

    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

    isPlaying

    boolean

    The 'isPlaying' property tells you if the ParticleSystem is currently playing. It's helpful to alter behavior based on the state of the ParticleSystem. Check out Unity's ParticleSystem.isPlaying Documentation.

    isEmitting

    boolean

    The 'isEmitting' property helps you to determine if the ParticleSystem is currently emitting particles. This can be particularly useful for performance optimization. See Unity's ParticleSystem.isEmitting Documentation.

    isStopped

    boolean

    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 Particle System's activity. More information in Unity's ParticleSystem.isStopped Documentation.

    isPaused

    boolean

    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. Consult Unity's ParticleSystem.isPaused Documentation for details.

    The 'particleCount' property provides the current number of particles in the ParticleSystem, which is useful for performance tuning and diagnostics. Refer to Unity's ParticleSystem.particleCount Documentation.

    time

    number

    The 'time' property returns how long the Particle System has been playing. It's particularly useful when you need to trigger events based on the playback time of your Particle System. More details at Unity's ParticleSystem.time Documentation.

    totalTime

    number

    The 'totalTime' property reflects the total lifetime of the Particle System in seconds. It's beneficial for initiating actions once the Particle System has ended. Check Unity's ParticleSystem.totalTime Documentation.

    The 'randomSeed' property allows you to seed the random number generator for reproducible effects. This can be beneficial for creating predictable visual effects. More at Unity's ParticleSystem.randomSeed Documentation.

    The 'useAutoRandomSeed' property, when set to true, lets Unity automatically generate a random seed allowing different effect each time. For more insights, check Unity's ParticleSystem.useAutoRandomSeed Documentation.

    The 'proceduralSimulationSupported' property indicates whether procedural simulation is supported on the Particle System. If supported, you can manipulate the Particle System without the overhead of enabling it. For further details, visit Unity's ParticleSystem.proceduralSimulationSupported Documentation.

    The 'has3DParticleRotations' property tells you if any particles in the Particle System have 3D rotations. Useful for optimizing processing when 3D rotations are not needed. Detailed info at Unity's ParticleSystem.has3DParticleRotations Documentation.

    The 'hasNonUniformParticleSizes' property indicates whether the Particle System contains particles of non-uniform sizes. When true, this could influence specific rendering techniques. Check Unity's ParticleSystem.hasNonUniformParticleSizes Documentation for more information.

    Methods

    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. See Unity's ParticleSystem.Stop Documentation for finer details.

    Parameters

    includeChildren

    boolean

    Should the method affect all children of this Particle System?

    Returns

    void

    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. Visit Unity's ParticleSystem.Simulate Documentation.

    Parameters

    t

    number

    The number of seconds to advance the Particle System simulation by.

    withChildren

    boolean

    Should the simulation include all children of this Particle System?

    restart

    boolean

    Should the Particle System be restarted before the simulation is run?

    fixedTimeStep

    boolean

    Should Unity simulate each individual time step for the full duration of 't'?

    Returns

    void

    To restart the Particle System or resume it after a pause, use the 'Play' method. It includes an optional parameter to include all child systems. Read more at Unity's ParticleSystem.Play Documentation.

    Parameters

    withChildren

    boolean

    Should the play request be propagated to all child systems?

    Returns

    void

    The 'Pause' method halts the simulation of the Particle System in its current state. It can be resumed later using the Play method. More details in Unity's ParticleSystem.Pause Documentation.

    Parameters

    withChildren

    boolean

    Should the pause request apply to all child systems?

    Returns

    void

    The 'Clear' method removes all particles in the Particle System. It's a handy way to reset the Particle System to an empty state. Check Unity's ParticleSystem.Clear Documentation for more details.

    Parameters

    withChildren

    boolean

    Should the clear request include all child systems?

    Returns

    void

    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 Particle System's state of activity. More info at Unity's ParticleSystem.IsAlive Documentation.

    Parameters

    withChildren

    boolean

    Should the check include all child systems?

    Returns

    boolean

    Returns true if the ParticleSystem is still alive.

    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 provides more details.

    Parameters

    count

    number

    The number of particles to emit.

    Returns

    void

    The 'TriggerSubEmitter' method triggers all sub-emitters on this Particle System, 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. More details are available in Unity's ParticleSystem.TriggerSubEmitter Documentation.

    Parameters

    subEmitterIndex

    number

    The index of the sub-emitter in the ParticleSystem's sub-emitters list.

    Returns

    void

    The 'AllocateAxisOfRotationAttribute' method allocates particle attribute data for storing a separate axis of rotation per particle. Check the Unity's ParticleSystem.AllocateAxisOfRotationAttribute Documentation for further information.

    Returns

    void

    The 'AllocateMeshIndexAttribute' method allows for particle attribute data allocation to store a separate mesh index per particle. Visit Unity's ParticleSystem.AllocateMeshIndexAttribute Documentation.

    Returns

    void

    The 'ResetPreMappedBufferMemory' method resets the pre-allocated memory used to store particle data for external read/write access. More information is available at Unity's ParticleSystem.ResetPreMappedBufferMemory Documentation.

    Returns

    void

    The 'SetMaximumPreMappedBufferCounts' method allows you to set the maximum buffer sizes for pre-mapped fixed buffers. Useful for optimizing memory usage. You can refer to Unity's ParticleSystem.SetMaximumPreMappedBufferCounts Documentation for more details.

    Parameters

    vertexBuffersCount

    number

    The maximum number of vertex buffers.

    indexBuffersCount

    number

    The maximum number of index buffers.

    Returns

    void

    Updated 4 months ago

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.