Skip to content

API Class ParticleSystem

github-actions[bot] edited this page Nov 30, 2026 · 8 revisions

Class: ParticleSystem

Defined in: src/engine/render/components.ts:369

Plays a particle effect asset at its node (ADR 0057, 0060): a *.particles.json graph authored in the Particle Graph. Particles follow the World's time, so pausing time pauses them, and they are cosmetic: never replicated, simulated on each client.

Extends

Constructors

Constructor

new ParticleSystem(): ParticleSystem;

Returns

ParticleSystem

Inherited from

Component.constructor

Properties

destroyOnFinish

destroyOnFinish: boolean = false;

Defined in: src/engine/render/components.ts:388

Destroy the node once a non-looping effect has finished and its last particle is gone.


effect

effect: string = "";

Defined in: src/engine/render/components.ts:371

The particle effect asset (asset:effects/sparks.particles.json).


embeddedEffect

embeddedEffect: Record<string, unknown> | null = null;

Defined in: src/engine/render/components.ts:376

Deprecated

Effects are assets (ADR 0060); the editor moves embedded effects into asset files. Still played, when effect is empty, so scenes saved before then keep working.


emissionScale

emissionScale: number = 1;

Defined in: src/engine/render/components.ts:386

Multiplies emission rates, bursts and the particle limit.


material

material: string = "";

Defined in: src/engine/render/components.ts:406

With a sortingLayer: a 2D material asset ("sprite-lit", the default when empty, or "sprite-unlit") saying whether 2D lights light the particles. Their colours and textures stay their outputs'.


orderInLayer

orderInLayer: number = 0;

Defined in: src/engine/render/components.ts:401

With a sortingLayer: the order within it (higher draws on top), as a SpriteRenderer's.


overrides

overrides: Record<string, ParticlePropertyValue> = {};

Defined in: src/engine/render/components.ts:378

This instance's values for the effect's exposed properties, by name (set them with setProperty).


playOnAwake

playOnAwake: boolean = true;

Defined in: src/engine/render/components.ts:380

Start playing when the node is created. Off: wait for play().


seed

seed: number = 0;

Defined in: src/engine/render/components.ts:393

Random seed. 0 = a new random sequence every play; any other integer = the same particles every play and restart, for replays, tests and lockstep.


sortingLayer

sortingLayer: string = "";

Defined in: src/engine/render/components.ts:399

2D (ADR 0415): the sorting layer its particles draw on, among sprites and tiles, at orderInLayer; and with a lit 2D material, lit by 2D lights like them (each output's flat light: no normal maps). Empty: drawn as 3D particles, ordered by their outputs' render order.


timeScale

timeScale: number = 1;

Defined in: src/engine/render/components.ts:382

Simulation speed (1 = normal), on top of the World's time scale.


tint

tint: Color = Color.white;

Defined in: src/engine/render/components.ts:384

Multiplies the particles' start colours.

Accessors

enabled

Get Signature

get enabled(): boolean;

Defined in: src/engine/core/Component.ts:62

Returns

boolean

Set Signature

set enabled(value): void;

Defined in: src/engine/core/Component.ts:66

Parameters
value

boolean

Returns

void

Inherited from

Component.enabled


gameObject

Get Signature

get gameObject(): GameObject;

Defined in: src/engine/core/Component.ts:42

Unity-style alias for node.

Returns

GameObject

Inherited from

Component.gameObject


isActiveAndEnabled

Get Signature

get isActiveAndEnabled(): boolean;

Defined in: src/engine/core/Component.ts:73

True when enabled, the node is active in the hierarchy, and the node is in a loaded world.

Returns

boolean

Inherited from

Component.isActiveAndEnabled


isAlive

Get Signature

get isAlive(): boolean;

Defined in: src/engine/render/components.ts:464

True while emitting or any particle is still alive.

Returns

boolean


isPlaying

Get Signature

get isPlaying(): boolean;

Defined in: src/engine/render/components.ts:459

True while emitting (not paused or stopped).

Returns

boolean


node

Get Signature

get node(): GameObject;

Defined in: src/engine/core/Component.ts:37

The node this component is on.

Returns

GameObject

Inherited from

Component.node


owner

Get Signature

get owner(): GameObject;

Defined in: src/engine/core/Component.ts:50

The node this component acts for: the node itself when attached directly, or the parent node when this component lives on a component node (ADR 0009).

Returns

GameObject

Inherited from

Component.owner


particleCount

Get Signature

get particleCount(): number;

Defined in: src/engine/render/components.ts:474

Particles alive now, across every emitter.

Returns

number


playTime

Get Signature

get playTime(): number;

Defined in: src/engine/render/components.ts:469

Seconds since the effect started (or restarted).

Returns

number


time

Get Signature

get time(): Readonly<TimeState>;

Defined in: src/engine/core/Component.ts:98

This component's World's clock (ADR 0032): the same values as Time, but safe to read outside the World's frame too (after an await, say).

Returns

Readonly<TimeState>

Inherited from

Component.time


transform

Get Signature

get transform(): Transform;

Defined in: src/engine/core/Component.ts:56

The Transform of the node this component is on, if it has one.

Returns

Transform

Inherited from

Component.transform


world

Get Signature

get world(): WorldHandle;

Defined in: src/engine/core/Component.ts:87

A handle on this component's World (ADR 0132): the same one Engine.findWorld returns. Load a scene into it, pause, connect or destroy it: this.world.loadScene("scenes/level2.scene.json"). Throws for a World no Engine owns.

Returns

WorldHandle

Inherited from

Component.world

Methods

clear()

clear(): void;

Defined in: src/engine/render/components.ts:434

Remove every particle, without stopping.

Returns

void


emit()

emit(count): void;

Defined in: src/engine/render/components.ts:439

Emit count particles at once from every emitter (sub-emitters aside).

Parameters

count

number

Returns

void


getProperty()

getProperty(name): 
  | ParticlePropertyValue
  | undefined;

Defined in: src/engine/render/components.ts:449

This instance's value of an exposed property, or undefined if it uses the effect's own value.

Parameters

name

string

Returns

| ParticlePropertyValue | undefined


instantiate()

instantiate(prefabPath, options?): GameObject;

Defined in: src/engine/core/Component.ts:108

Instantiate a prefab in this component's World (ADR 0034), like GameObject.instantiate. Use it in code that may run after an await: by then the frame is over and the current World is the Engine's default one, which may not be this component's. A parent from another World throws.

Parameters

prefabPath

string

options?

InstantiateOptions = {}

Returns

GameObject

Inherited from

Component.instantiate


pause()

pause(): void;

Defined in: src/engine/render/components.ts:419

Freeze the effect where it is; play() resumes it.

Returns

void


play()

play(): void;

Defined in: src/engine/render/components.ts:414

Start, or resume after pause().

Returns

void


restart()

restart(): void;

Defined in: src/engine/render/components.ts:429

Start again from the beginning, removing the particles already out.

Returns

void


sendEvent()

sendEvent(name): void;

Defined in: src/engine/render/components.ts:454

Send a custom event (an Event node named name in the graph), which starts or stops the systems it's wired to.

Parameters

name

string

Returns

void


setProperty()

setProperty(name, value): void;

Defined in: src/engine/render/components.ts:444

Set one of the effect's exposed properties for this instance; it applies on the next frame.

Parameters

name

string

value

ParticlePropertyValue

Returns

void


stop()

stop(options?): void;

Defined in: src/engine/render/components.ts:424

Stop emitting. Particles already out live out their lives, unless clear removes them at once.

Parameters

options?
clear?

boolean

Returns

void

Clone this wiki locally