class
ParticleEffect
public sealed class ParticleEffect : Component Defines and holds particles. This is the core of the particle system.
Constructors
ParticleEffect() Properties
| Name | Type | Description |
|---|---|---|
MaxParticles | Int32 | The maximum number of particles that can exist in this effect at once. |
Lifetime | ParticleFloat | The lifetime of each particle, in seconds. |
TimeScale | Single | Scales the simulation time for this effect. |
PreWarm | Single | How many seconds to pre-warm this effect by when creating. |
StartDelay | ParticleFloat | The delay before a particle starts after being emitted, in seconds. |
PerParticleTimeScale | ParticleFloat | Per-particle time scale multiplier. Allows each particle to have a unique simulation speed. |
Timing | TimingMode | How time is updated for this effect. |
InitialVelocity | ParticleVector3 | The initial velocity of the particle when it is created. This is applied before any forces are applied. |
StartVelocity | ParticleFloat | Apply an element of random velocity to the particle when it is created, in a random direction. |
Damping | ParticleFloat | The damping factor applied to particle velocity over time. This reduces the velocity of particles, simulating resistance or drag. |
ConstantMovement | ParticleVector3 | Move this delta constantly. Ignores velocity, collisions and drag. |
Space | SimulationSpace | |
LocalSpace | ParticleFloat | When 1 particles will be moved in local space relative to the emitter GameObject's transform. This allows particles to be emitted in a local space, like a fire effect that moves with the player, but the particles can slowly move to world space. |
ApplyRotation | Boolean | Enables or disables rotation for particles. |
Pitch | ParticleFloat | The pitch rotation of the particles. |
Yaw | ParticleFloat | The yaw rotation of the particles. |
Roll | ParticleFloat | The roll rotation of the particles. |
ApplyColor | Boolean | Enables or disables color application for particles. |
ApplyAlpha | Boolean | Enables or disables alpha application for particles. |
Tint | Color | The tint color applied to particles. |
Gradient | ParticleGradient | The gradient used to color particles over their lifetime. |
Brightness | ParticleFloat | The brightness multiplier applied to particles. |
Alpha | ParticleFloat | The alpha transparency of particles. |
ApplyShape | Boolean | Enables or disables shape application for particles. |
Scale | ParticleFloat | The scale of particles. |
Stretch | ParticleFloat | The stretch factor of particles, affecting their aspect ratio. |
Force | Boolean | Enables or disables the application of forces to particles. |
ForceDirection | Vector3 | The direction of the force applied to particles. |
ForceScale | ParticleFloat | The scale of the force applied to each particle. This multiplier determines the intensity of the force applied to particles. |
OrbitalForce | ParticleVector3 | The orbital force applied to particles, causing them to rotate around a point. |
OrbitalPull | ParticleFloat | The pull strength of the orbital force, drawing particles closer to the center. |
ForceSpace | SimulationSpace | The simulation space in which forces are applied. Forces can be applied in either local space (relative to the emitter) or world space. |
Collision | Boolean | Enables or disables collision behavior for particles. |
DieOnCollisionChance | ParticleFloat | The chance that a particle will die upon collision. |
CollisionRadius | Single | The radius used for collision detection. |
CollisionIgnore | TagSet | The set of tags to ignore during collision detection. |
Bounce | ParticleFloat | The bounce factor applied to particles upon collision. |
Friction | ParticleFloat | The friction factor applied to particles upon collision. |
Bumpiness | ParticleFloat | The bumpiness factor applied to particles upon collision. |
PushStrength | ParticleFloat | The strength of the push force applied to particles upon collision. |
SheetSequence | Boolean | Enables or disables the use of a sheet sequence for particles. |
SequenceId | ParticleFloat | Which sequence to use. |
SequenceTime | ParticleFloat | Allows control of the sequence time, which spans from 0 to 1 for one loop. |
SequenceSpeed | ParticleFloat | Increment the sequence time by this much. |
SnapToFrame | Boolean | When enabled, snap to the nearest whole frame instead of blending between frames. |
UsePrefabFeature | Boolean | Enables or disables the use of prefabs for particles. |
FollowerPrefab | List<GameObject> | Will choose a random prefab to spawn from this list. |
FollowerPrefabChance | ParticleFloat | If 1 then we'll always spawn a prefab. If 0.5 then we'll spawn a prefab 50% of the time. |
FollowerPrefabKill | Boolean | When true the prefab will be destroyed at the end of the particle's life. |
CollisionPrefab | List<GameObject> | Will choose a random prefab to spawn from this list. |
CollisionPrefabAlign | Boolean | When true the collision prefab will be aligned with the surface it collides with. |
CollisionPrefabRotation | ParticleFloat | We will by default align to the particle's angle, but we can also randomize that. |
CollisionPrefabChance | ParticleFloat | If 1 then we'll always spawn a prefab. If 0.5 then we'll spawn a prefab 50% of the time. |
OnParticleDestroyed | Action<Particle> | Called any time a particle is destroyed. |
OnParticleCreated | Action<Particle> | Called any time a particle is created. |
Particles | List<Particle> | Active particles in the effect. Active particles are those currently being simulated and rendered. |
DelayedParticles | List<Particle> | Delayed particles in the effect. Delayed particles are those that have been emitted but are waiting to be activated based on their start delay. |
ParticleCount | Int32 | The total number of particles in the effect, including both active and delayed particles. |
IsFull | Boolean | Whether the particle effect has reached its maximum capacity. This is determined by comparing the total particle count to the MaxParticles property. |
Paused | Boolean | Whether the particle simulation is currently paused. When paused, particles will not update their positions, velocities, or other properties. |
OnPreStep | Action<Single> | Called before the particles are stepped. This allows custom logic to be executed before the simulation advances. |
OnPostStep | Action<Single> | Called after the particles are stepped. This allows custom logic to be executed after the simulation advances. |
OnStep | Action<Particle, Single> | Called after each particle is stepped. This provides an opportunity to modify individual particles during the simulation. |
ParticleBounds | BBox | The bounding box that encompasses all active particles. This is useful for determining the spatial extent of the particle effect. |
MaxParticleSize | Single | The size of the largest particle in the effect. This is determined by the maximum scale of any particle along its x, y, or z axis. |
ComponentVersion virtual | Int32 |
Methods
Void Clear() Void ResetEmitters() Void Step(Single timeDelta) Particle Emit(Vector3 position, Single delta) Emit a particle at the given position.
position — The position in which to spawn the particle delta — The time delta of the spawn. The first spawned particle is 0, the last spawned particle is 1. This is used to evaluate the spawn particles like lifetime and delay. returns — A particle, will never be null. It's up to you to obey max particles.
Void Terminate(Particle p)