pub struct ParticleSystem {Show 43 fields
pub ClampVelocityModule: ClampVelocityModule,
pub CollisionModule: CollisionModule,
pub ColorBySpeedModule: ColorBySpeedModule,
pub ColorModule: ColorModule,
pub EmissionModule: EmissionModule,
pub ForceModule: ForceModule,
pub InitialModule: InitialModule,
pub RotationBySpeedModule: RotationBySpeedModule,
pub RotationModule: RotationModule,
pub ShapeModule: ShapeModule,
pub SizeBySpeedModule: SizeBySpeedModule,
pub SizeModule: SizeModule,
pub SubModule: SubModule,
pub UVModule: UVModule,
pub VelocityModule: VelocityModule,
pub lengthInSec: f32,
pub looping: bool,
pub m_GameObject: PPtr,
pub moveWithTransform: Enum_bool__i32,
pub playOnAwake: bool,
pub prewarm: bool,
pub randomSeed: i64,
pub startDelay: Enum_f32__MinMaxCurve,
pub CustomDataModule: Option<CustomDataModule>,
pub ExternalForcesModule: Option<ExternalForcesModule>,
pub InheritVelocityModule: Option<InheritVelocityModule>,
pub LifetimeByEmitterSpeedModule: Option<LifetimeByEmitterSpeedModule>,
pub LightsModule: Option<LightsModule>,
pub NoiseModule: Option<NoiseModule>,
pub TrailModule: Option<TrailModule>,
pub TriggerModule: Option<TriggerModule>,
pub autoRandomSeed: Option<bool>,
pub cullingMode: Option<i32>,
pub emitterVelocityMode: Option<i32>,
pub moveWithCustomTransform: Option<PPtr>,
pub ringBufferLoopRange: Option<Vector2f>,
pub ringBufferMode: Option<i32>,
pub scalingMode: Option<i32>,
pub simulationSpeed: Option<f32>,
pub speed: Option<f32>,
pub stopAction: Option<i32>,
pub useRigidbodyForVelocity: Option<bool>,
pub useUnscaledTime: Option<bool>,
}Expand description
ParticleSystem is a class of the Unity engine since version 3.5.0. Exert from Unity’s scripting documentation: Script interface for the Built-in Particle System. Unity’s powerful and versatile particle system implementation. General parameters
The Particle System’s general parameters are kept inside a special Main module. These parameters are visible in the Inspector above all the other modules:In script, these parameters are accessible through ParticleSystem.main.Accessing module propertiesParticle System properties are grouped by the module they belong to, such as ParticleSystem.noise and ParticleSystem.emission. These properties are structs, but do not behave like normal C# structs. They are simply interfaces directly into the native code, so it is important to know how to use them, compared to a normal C# struct.The key difference is that it is not necessary to assign the struct back to the Particle System component. When you set any property on a module struct, Unity immediately assigns that value to the Particle System.Also, because each module is a struct, you must cache it in a local variable before you can assign any new values to the module. For example, instead of: ParticleSystem.emission.enabled = true; // Doesn’t compile
write: var emission = ParticleSystem.emission; // Stores the module in a local variable emission.enabled = true; // Applies the new value directly to the Particle SystemModule effect multipliersEvery module has special multiplier properties that allow you to change the overall effect of a curve without having to edit the curve itself. These multiplier properties are all named after the curve they affect - for instance ParticleSystem.emission.rateMultiplier controls the overall effect of ParticleSystem.emission.rate in a given system.Constant value shorthandParameters support a shorthand notation for simple constant values. To set a constant value for a parameter, all you need to do is assign a number to it. It is not necessary to create a MinMaxCurve or MinMaxGradient object in the ParticleSystemCurveMode.Constant mode.For example, instead of: var emission = ParticleSystem.emission; emission.rate = new ParticleSystem.MinMaxCurve(5.0f);
write: var emission = ParticleSystem.emission; emission.rate = 5.0f;Performance note: When setting properties on particle modules, the settings are passed immediately into native code. This gives the best performance. This means that setting properties on a module struct doesn’t set something in script that requires setting back to the Particle System; it all happens automatically.See Also: Particle.
Fields§
§ClampVelocityModule: ClampVelocityModule§CollisionModule: CollisionModule§ColorBySpeedModule: ColorBySpeedModule§ColorModule: ColorModule§EmissionModule: EmissionModule§ForceModule: ForceModule§InitialModule: InitialModule§RotationBySpeedModule: RotationBySpeedModule§RotationModule: RotationModule§ShapeModule: ShapeModule§SizeBySpeedModule: SizeBySpeedModule§SizeModule: SizeModule§SubModule: SubModule§UVModule: UVModule§VelocityModule: VelocityModule§lengthInSec: f32§looping: bool§m_GameObject: PPtrThe game object this component is attached to. A component is always attached to a game object.
PPtr<GameObject>: (3.5.0 - 2022.3.2f1)
moveWithTransform: Enum_bool__i32§playOnAwake: bool§prewarm: bool§randomSeed: i64Override the random seed used for the Particle System emission.
startDelay: Enum_f32__MinMaxCurve§CustomDataModule: Option<CustomDataModule>CustomDataModule: (5.6.0b1 - 2022.3.2f1)
ExternalForcesModule: Option<ExternalForcesModule>ExternalForcesModule: (4.0.0 - 2022.3.2f1)
InheritVelocityModule: Option<InheritVelocityModule>InheritVelocityModule: (5.3.0f1 - 2022.3.2f1)
LifetimeByEmitterSpeedModule: Option<LifetimeByEmitterSpeedModule>LifetimeByEmitterSpeedModule: (2020.1.0b1 - 2022.3.2f1)
LightsModule: Option<LightsModule>LightsModule: (5.5.0f3 - 2022.3.2f1)
NoiseModule: Option<NoiseModule>NoiseModule: (5.5.0f3 - 2022.3.2f1)
TrailModule: Option<TrailModule>TrailModule: (5.5.0f3 - 2022.3.2f1)
TriggerModule: Option<TriggerModule>TriggerModule: (5.4.0f3 - 2022.3.2f1)
autoRandomSeed: Option<bool>bool: (5.4.1f1 - 2022.3.2f1)
cullingMode: Option<i32>i32: (2018.3.0f2 - 2022.3.2f1)
emitterVelocityMode: Option<i32>i32: (2021.1.0b1 - 2022.3.2f1)
moveWithCustomTransform: Option<PPtr>PPtr<Transform>: (5.5.0f3 - 2022.3.2f1)
ringBufferLoopRange: Option<Vector2f>Vector2f: (2018.3.0f2 - 2022.3.2f1)
ringBufferMode: Option<i32>i32: (2018.3.0f2 - 2022.3.2f1)
scalingMode: Option<i32>i32: (5.3.0f1 - 2022.3.2f1)
simulationSpeed: Option<f32>f32: (5.5.1f1 - 2022.3.2f1)
speed: Option<f32>f32: (3.5.0 - 5.5.0f3)
stopAction: Option<i32>i32: (2017.2.0b2 - 2022.3.2f1)
useRigidbodyForVelocity: Option<bool>bool: (2017.1.0f2 - 2021.1.0a6)
useUnscaledTime: Option<bool>bool: (2017.1.0b2 - 2022.3.2f1)