Class: ParticleSystem2DComponent
Unity's ParticleSystem, in 2D (a 3D one will sit beside it): a Main block plus modules, each module a schema group whose header checkbox is its …Enabled flag. Values that vary are MinMaxCurves / MinMaxGradients (Particles/ParticleCurves.ts) — a plain number or colour is the constant form. Distances are pixels, angles degrees, times seconds; +y is up.
Behaviour lives in ParticleSimulation2D (one per component, _sim) and the particle systems (Systems/ParticleSystem2DSystem.ts): they step it once per rendered frame and draw it through the renderer's ParticleCapability. Child particle systems play / stop with their parent; a child whose subEmitterTrigger is set is instead a sub-emitter of its nearest particle-system ancestor — it only emits when the parent's particles are born / die / collide.
Extends
Constructors
Constructor
ts
new ParticleSystem2DComponent(): ParticleSystem2DComponent;Returns
ParticleSystem2DComponent
Inherited from
Properties
| Property | Modifier | Type | Default value | Inherited from |
|---|---|---|---|---|
alignToDirection | public | boolean | undefined | - |
angularVelocity | public | MinMaxCurve | undefined | - |
arcMode | public | ParticleArcMode | undefined | - |
arcSpeed | public | number | undefined | - |
arcSpread | public | number | undefined | - |
assetId | public | string | undefined | - |
autoRandomSeed | public | boolean | undefined | - |
blendMode | public | ParticleBlendMode | undefined | - |
bounce | public | number | undefined | - |
bursts | public | ParticleBurst[] | undefined | - |
collisionDampen | public | number | undefined | - |
collisionEnabled | public | boolean | undefined | - |
collisionPlane | public | Entity | null | undefined | - |
collisionPlane2 | public | Entity | null | undefined | - |
collisionPlane3 | public | Entity | null | undefined | - |
colorBySpeed | public | MinMaxGradient | undefined | - |
colorBySpeedEnabled | public | boolean | undefined | - |
colorOverLifetime | public | MinMaxGradient | undefined | - |
colorOverLifetimeEnabled | public | boolean | undefined | - |
colorSpeedRange | public | [number, number] | undefined | - |
dampen | public | number | undefined | - |
dirty | public | boolean | true | Component.dirty |
drag | public | MinMaxCurve | undefined | - |
duration | public | number | undefined | - |
emissionEnabled | public | boolean | undefined | - |
emitFromEdge | public | boolean | undefined | - |
enabled | public | boolean | true | Component.enabled |
flipRotation | public | number | undefined | - |
flipX | public | number | undefined | - |
flipY | public | number | undefined | - |
forceEnabled | public | boolean | undefined | - |
forceRandomize | public | boolean | undefined | - |
forceSpace | public | ParticleSpace | undefined | - |
forceX | public | MinMaxCurve | undefined | - |
forceY | public | MinMaxCurve | undefined | - |
frameOverTime | public | MinMaxCurve | undefined | - |
gravityModifier | public | MinMaxCurve | undefined | - |
inheritParticleColor | public | boolean | undefined | - |
inheritVelocity | public | MinMaxCurve | undefined | - |
inheritVelocityEnabled | public | boolean | undefined | - |
inheritVelocityMode | public | "initial" | "current" | undefined | - |
lengthScale | public | number | undefined | - |
lifetimeLoss | public | number | undefined | - |
limitVelocityEnabled | public | boolean | undefined | - |
looping | public | boolean | undefined | - |
material | public | string | undefined | - |
materialValues | public | Record<string, unknown> | undefined | - |
maxParticles | public | number | undefined | - |
minKillSpeed | public | number | undefined | - |
minVertexDistance | public | number | undefined | - |
multiplyDragBySize | public | boolean | undefined | - |
multiplyDragByVelocity | public | boolean | undefined | - |
noiseEnabled | public | boolean | undefined | - |
noiseFrequency | public | number | undefined | - |
noiseOctaveMultiplier | public | number | undefined | - |
noiseOctaves | public | number | undefined | - |
noiseOctaveScale | public | number | undefined | - |
noisePositionAmount | public | number | undefined | - |
noiseRotationAmount | public | number | undefined | - |
noiseScrollSpeed | public | number | undefined | - |
noiseSizeAmount | public | number | undefined | - |
noiseStrength | public | MinMaxCurve | undefined | - |
orbitalOffset | public | [number, number] | undefined | - |
orbitalVelocity | public | MinMaxCurve | undefined | - |
playOnAwake | public | boolean | undefined | - |
prewarm | public | boolean | undefined | - |
radialVelocity | public | MinMaxCurve | undefined | - |
radiusScale | public | number | undefined | - |
radiusThickness | public | number | undefined | - |
randomizeDirection | public | number | undefined | - |
randomizePosition | public | number | undefined | - |
randomSeed | public | number | undefined | - |
rateOverDistance | public | MinMaxCurve | undefined | - |
rateOverTime | public | MinMaxCurve | undefined | - |
renderMode | public | "billboard" | "stretched" | undefined | - |
ribbonCount | public | number | undefined | - |
rotationBySpeed | public | MinMaxCurve | undefined | - |
rotationBySpeedEnabled | public | boolean | undefined | - |
rotationOverLifetimeEnabled | public | boolean | undefined | - |
rotationSpeedRange | public | [number, number] | undefined | - |
sendCollisionEvents | public | boolean | undefined | - |
shape | public | ParticleShape | undefined | - |
shapeAngle | public | number | undefined | - |
shapeArc | public | number | undefined | - |
shapeEnabled | public | boolean | undefined | - |
shapeHeight | public | number | undefined | - |
shapeLength | public | number | undefined | - |
shapePosition | public | [number, number] | undefined | - |
shapeRadius | public | number | undefined | - |
shapeRotation | public | number | undefined | - |
shapeScale | public | [number, number] | undefined | - |
shapeWidth | public | number | undefined | - |
sheetAnimation | public | "wholeSheet" | "singleRow" | undefined | - |
sheetCycles | public | number | undefined | - |
sheetRow | public | number | undefined | - |
sheetRowMode | public | "random" | "custom" | undefined | - |
simulationSpace | public | ParticleSpace | undefined | - |
simulationSpeed | public | number | undefined | - |
sizeAffectsWidth | public | boolean | undefined | - |
sizeBySpeed | public | MinMaxCurve | undefined | - |
sizeBySpeedEnabled | public | boolean | undefined | - |
sizeOverLifetime | public | MinMaxCurve | undefined | - |
sizeOverLifetimeEnabled | public | boolean | undefined | - |
sizeOverLifetimeY | public | MinMaxCurve | undefined | - |
sizeSeparateAxes | public | boolean | undefined | - |
sizeSpeedRange | public | [number, number] | undefined | - |
sortMode | public | "youngestInFront" | "oldestInFront" | undefined | - |
speedLimit | public | MinMaxCurve | undefined | - |
speedModifier | public | MinMaxCurve | undefined | - |
speedScale | public | number | undefined | - |
sphericalizeDirection | public | number | undefined | - |
startColor | public | MinMaxGradient | undefined | - |
startDelay | public | MinMaxCurve | undefined | - |
startFrame | public | MinMaxCurve | undefined | - |
startLifetime | public | MinMaxCurve | undefined | - |
startRotation | public | MinMaxCurve | undefined | - |
startSize | public | MinMaxCurve | undefined | - |
startSizeSeparate | public | boolean | undefined | - |
startSizeY | public | MinMaxCurve | undefined | - |
startSpeed | public | MinMaxCurve | undefined | - |
stopAction | public | ParticleStopAction | undefined | - |
subEmitterInheritColor | public | boolean | undefined | - |
subEmitterInheritRotation | public | boolean | undefined | - |
subEmitterInheritSize | public | boolean | undefined | - |
subEmitterProbability | public | number | undefined | - |
subEmitterTrigger | public | ParticleSubEmitterTrigger | undefined | - |
textureSheetEnabled | public | boolean | undefined | - |
tilesX | public | number | undefined | - |
tilesY | public | number | undefined | - |
trailAssetId | public | string | undefined | - |
trailColorOverLifetime | public | MinMaxGradient | undefined | - |
trailColorOverTrail | public | MinMaxGradient | undefined | - |
trailLifetime | public | MinMaxCurve | undefined | - |
trailMode | public | ParticleTrailMode | undefined | - |
trailRatio | public | number | undefined | - |
trailsEnabled | public | boolean | undefined | - |
trailWidth | public | MinMaxCurve | undefined | - |
useUnscaledTime | public | boolean | undefined | - |
velocityEnabled | public | boolean | undefined | - |
velocitySpace | public | ParticleSpace | undefined | - |
velocityX | public | MinMaxCurve | undefined | - |
velocityY | public | MinMaxCurve | undefined | - |
Accessors
particleCount
Get Signature
ts
get particleCount(): number;Returns
number
time
Get Signature
ts
get time(): number;Seconds into the current cycle (0..duration).
Returns
number
Methods
ApplyPreset()
ts
ApplyPreset(preset): void;Replaces every setting with a .particle preset's (defaults where it says nothing) — e.g. ApplyPreset(Game.assets.Get('internal/particles/Fire')). Child systems in the preset are an editor concern; this sets this component only. Call Restart() to see it from the start.
Parameters
| Parameter | Type |
|---|---|
preset | | Record<string, unknown> | ParticlePreset2D |
Returns
void
Clear()
ts
Clear(withChildren?): void;Parameters
| Parameter | Type | Default value |
|---|---|---|
withChildren | boolean | true |
Returns
void
Emit()
ts
Emit(count): void;Emits count particles now, from the shape, whether or not the system is playing.
Parameters
| Parameter | Type |
|---|---|
count | number |
Returns
void
IsAlive()
ts
IsAlive(withChildren?): boolean;Emitting, or particles left — this system's or a child's.
Parameters
| Parameter | Type | Default value |
|---|---|---|
withChildren | boolean | true |
Returns
boolean
IsEmitting()
ts
IsEmitting(): boolean;Returns
boolean
IsPaused()
ts
IsPaused(): boolean;Returns
boolean
IsPlaying()
ts
IsPlaying(): boolean;Returns
boolean
IsStopped()
ts
IsStopped(): boolean;Returns
boolean
Pause()
ts
Pause(withChildren?): void;Holds the simulation where it is; the particles stay on screen. Play resumes.
Parameters
| Parameter | Type | Default value |
|---|---|---|
withChildren | boolean | true |
Returns
void
Play()
ts
Play(withChildren?): void;---- Playback (Unity's ParticleSystem API). withChildren also drives child particle systems that aren't sub-emitters. ----
Parameters
| Parameter | Type | Default value |
|---|---|---|
withChildren | boolean | true |
Returns
void
Restart()
ts
Restart(withChildren?): void;Stop + clear + play from the start (a fresh seed unless the seed is fixed).
Parameters
| Parameter | Type | Default value |
|---|---|---|
withChildren | boolean | true |
Returns
void
Simulate()
ts
Simulate(
seconds,
withChildren?,
restart?
): void;Fast-forwards by seconds (in 1/30 s steps) — e.g. to start an effect mid-way.
Parameters
| Parameter | Type | Default value |
|---|---|---|
seconds | number | undefined |
withChildren | boolean | true |
restart | boolean | false |
Returns
void
Stop()
ts
Stop(withChildren?, clear?): void;Stops emitting; live particles finish their lives unless clear.
Parameters
| Parameter | Type | Default value |
|---|---|---|
withChildren | boolean | true |
clear | boolean | false |
Returns
void