Guides VFX & Particles Particles Create a 2D Particle Effect

VFX & Particles Particles 4 min read Updated Aug 2026

Create a 2D Particle Effect

This guide creates a small 2D sparkle burst. The same workflow works for dust, impact sparks, pickup flashes, smoke puffs, and ambient motes.

Create The Emitter

  1. Select or create the GameObject that should own the effect.
  2. In the Inspector, choose Add Component.
  3. Open 2D.
  4. Open Rendering.
  5. Choose Particle System.

The component starts in 2D mode. If it does not, set Dimension to 2D.

Set the GameObject position where particles should spawn. For an effect attached to a player, weapon, torch, pickup, or impact point, the GameObject's transform becomes the emitter origin.

Choose The Visual

The Texture field controls what each particle looks like.

Leave Texture empty for quick circles. Assign a sprite texture when the effect needs a specific shape such as a spark, dust puff, smoke blob, raindrop, or star.

Good particle textures are usually:

  • small
  • high contrast at the center
  • soft or transparent at the edge
  • authored on a transparent background
  • easy to read when tinted by the particle color

If the effect disappears after assigning a texture, check that the path is project-relative, the file is imported as a sprite/texture asset, and the alpha channel is not fully transparent.

Set Playback

Use Play On Awake when the effect should begin as soon as the scene starts. Smoke, rain, fire, and ambient motes usually play on awake.

Turn Play On Awake off for effects triggered by gameplay, such as a pickup burst or landing dust. Trigger those with PHP using emit() or restart().

Use Looping for continuous effects. Turn it off for one-shot bursts.

For a sparkle burst:

  • Play On Awake: off
  • Looping: off
  • Max Particles: 48
  • Rate over Time: 0

Then use a burst from script or call emit() during preview.

For continuous dust:

  • Play On Awake: on
  • Looping: on
  • Max Particles: 128
  • Rate over Time: 12 to 30

Tune Lifetime And Motion

Lifetime controls how long each particle exists. Short lifetimes feel snappy. Longer lifetimes feel airy or smoky.

Start Speed controls how fast particles leave the emitter. A pickup sparkle might use a fast start speed. A smoke puff might use a slow start speed and upward force.

Emission Angle aims the emitter. In 2D, -90 points upward in the common screen-space setup. Spread Angle controls how wide the cone is.

Examples:

  • Narrow upward dust: Emission Angle -90, Spread Angle 35
  • Circular sparkle burst: Spread Angle 360
  • Sideways hit sparks: aim toward the impact normal and use Spread Angle 25

Shape The Particle Over Its Lifetime

Use Start Size and End Size to describe the main size change. A dust puff often grows as it fades. A spark often shrinks.

Use Start Color for the color particles receive at spawn. Use Color Over Lifetime to fade or shift that color as particles age. For most 2D effects, the final color-over-lifetime key should fade to alpha 0.

Common patterns:

  • Spark: bright yellow or white at start, orange and transparent at end
  • Dust: opaque tan/gray at start, larger and transparent at end
  • Smoke: dark gray at start, lighter and transparent at end
  • Magic: saturated color at start, pale and transparent at end

Sort With The Scene

2D particles use Sorting Layer and Order In Layer.

Use the same sorting layer strategy as sprites:

  • behind the player: lower order than the player sprite
  • in front of terrain: higher order than the ground
  • world-space UI-like effects: dedicated layer or high order

If particles are running but invisible, sorting is one of the first things to check.

Preview In The Scene

Use the scene view FX toggle to see selected particle systems in edit mode. The preview uses the same particle settings used in-game, so size, color, motion, and shape should match closely.

If the system is not visible in preview:

  • confirm Max Particles is not too low
  • temporarily enable Play On Awake
  • increase Rate over Time
  • clear or replace missing textures
  • check sorting layer and order
  • make sure the selected GameObject is near the scene view camera

Trigger It From PHP

use Lenga\Engine\Core\Behaviour;
use Lenga\Engine\Core\ParticleSystem;

final class PickupSparkle extends Behaviour
{
    private ?ParticleSystem $particles = null;

    public function start(): void
    {
        $this->particles = $this->getComponent(ParticleSystem::class);
        $this->particles?->stop(true);
    }

    public function playEffect(): void
    {
        $this->particles?->clear();
        $this->particles?->emit(32);
        $this->particles?->play();
    }
}

Use the editor to shape the effect, then use PHP to decide when it happens.