Class ParticleEffect
The particle system instance that plays the particles simulation in the game.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[ActorContextMenu("New/Visuals/Particle Effect")]
[ActorToolbox("Visuals")]
[Unmanaged]
public class ParticleEffect : Actor, ISerializable
Constructors
ParticleEffect()
Properties
DrawModes
The draw passes to use for rendering this object.
Declaration
[EditorDisplay("Particle Effect", null)]
[EditorOrder(75)]
[Unmanaged]
public DrawPass DrawModes { get; set; }
Property Value
DrawPass
|
FixedTimestep
The fixed timestep for simulation updates. Used only if UpdateMode is set to FixedTimestep.
Declaration
[EditorDisplay("Particle Effect", null)]
[EditorOrder(20)]
[VisibleIf("IsFixedTimestep", false)]
[Unmanaged]
public float FixedTimestep { get; set; }
Property Value
System.Single
|
IsLooping
Determines whether the particle effect should loop when it finishes playing.
Declaration
[EditorDisplay("Particle Effect", null)]
[EditorOrder(50)]
[Unmanaged]
public bool IsLooping { get; set; }
Property Value
System.Boolean
|
Parameters
Gets the effect parameters collection. Those parameters are instanced from the ParticleSystem that contains a linear list of emitters and every emitter has a list of own parameters.
Declaration
[Unmanaged]
public ParticleEffectParameter[] Parameters { get; }
Property Value
ParticleEffectParameter[]
|
ParametersVersion
Gets the effect parameters collection version number. It can be used to track parameters changes that occur when particle system or one of the emitters gets reloaded/edited.
Declaration
[Unmanaged]
public uint ParametersVersion { get; }
Property Value
System.UInt32
|
ParticlesCount
Gets the particles count (total). GPU particles count is read with one frame delay (due to GPU execution).
Declaration
[Unmanaged]
public int ParticlesCount { get; }
Property Value
System.Int32
|
ParticleSystem
The particle system to play.
Declaration
[EditorDisplay("Particle Effect", null)]
[EditorOrder(0)]
[Unmanaged]
public ParticleSystem ParticleSystem { get; set; }
Property Value
ParticleSystem
|
PlayOnStart
Determines whether the particle effect should play on start.
Declaration
[EditorDisplay("Particle Effect", null)]
[EditorOrder(60)]
[Unmanaged]
public bool PlayOnStart { get; set; }
Property Value
System.Boolean
|
SimulationSpeed
The particles simulation speed factor. Scales the particle system update delta time. Can be used to speed up or slow down the particles.
Declaration
[EditorDisplay("Particle Effect", null)]
[EditorOrder(30)]
[Unmanaged]
public float SimulationSpeed { get; set; }
Property Value
System.Single
|
SortOrder
The object sort order key used when sorting drawable objects during rendering. Use lower values to draw object before others, higher values are rendered later (on top). Can be used to control transparency drawing.
Declaration
[EditorDisplay("Particle Effect", null)]
[EditorOrder(80)]
[Unmanaged]
public sbyte SortOrder { get; set; }
Property Value
System.SByte
|
UpdateMode
The particles simulation update mode. Defines how to update particles emitter.
Declaration
[EditorDisplay("Particle Effect", null)]
[EditorOrder(10)]
[Unmanaged]
public ParticleEffect.SimulationUpdateMode UpdateMode { get; set; }
Property Value
ParticleEffect.SimulationUpdateMode
|
UpdateWhenOffscreen
If true, the particle simulation will be updated even when an actor cannot be seen by any camera. Otherwise, the simulation will stop running when the actor is off-screen.
Declaration
[EditorDisplay("Particle Effect", null)]
[EditorOrder(70)]
[Unmanaged]
public bool UpdateWhenOffscreen { get; set; }
Property Value
System.Boolean
|
UseTimeScale
Determines whether the particle effect should take into account the global game time scale for simulation updates.
Declaration
[EditorDisplay("Particle Effect", null)]
[EditorOrder(40)]
[Unmanaged]
public bool UseTimeScale { get; set; }
Property Value
System.Boolean
|
Methods
GetParameter(String, Guid)
Gets the particle parameter.
Declaration
[Unmanaged]
public ParticleEffectParameter GetParameter(string emitterTrackName, Guid paramId)
Parameters
System.String
emitterTrackName
The emitter track name (in particle system asset). |
System.Guid
paramId
The emitter parameter ID (in particle emitter asset). |
Returns
ParticleEffectParameter
The effect parameter or null if failed to find. |
GetParameter(String, String)
Gets the particle parameter.
Declaration
[Unmanaged]
public ParticleEffectParameter GetParameter(string emitterTrackName, string paramName)
Parameters
System.String
emitterTrackName
The emitter track name (in particle system asset). |
System.String
paramName
The emitter parameter name (in particle emitter asset). |
Returns
ParticleEffectParameter
The effect parameter or null if failed to find. |
GetParameterValue(String, String)
Gets the particle parameter value.
Declaration
[Unmanaged]
public object GetParameterValue(string emitterTrackName, string paramName)
Parameters
System.String
emitterTrackName
The emitter track name (in particle system asset). |
System.String
paramName
The emitter parameter name (in particle emitter asset). |
Returns
System.Object
The value. |
Pause()
Pauses the simulation.
Declaration
[Unmanaged]
public void Pause()
Play()
Plays the simulation.
Declaration
[Unmanaged]
public void Play()
ResetParameters()
Resets the particle system parameters to the default values from asset.
Declaration
[Unmanaged]
public void ResetParameters()
ResetSimulation()
Resets the particles simulation state (clears the instance state data but preserves the instance parameters values).
Declaration
[Unmanaged]
public void ResetSimulation()
SetParameterValue(String, String, Object)
Set the particle parameter value.
Declaration
[Unmanaged]
public void SetParameterValue(string emitterTrackName, string paramName, object value)
Parameters
System.String
emitterTrackName
The emitter track name (in particle system asset). |
System.String
paramName
The emitter parameter name (in particle emitter asset). |
System.Object
value
The value to set. |
SpawnParticles(Int32, String)
Manually spawns additional particles into the simulation.
Declaration
[Unmanaged]
public void SpawnParticles(int count, string emitterTrackName = null)
Parameters
System.Int32
count
Amount of particles to spawn. |
System.String
emitterTrackName
Name of the emitter track to spawn particles in. Empty if spawn particles into all tracks. |
Stop()
Stops and resets the simulation.
Declaration
[Unmanaged]
public void Stop()
UpdateSimulation(Boolean)
Performs the full particles simulation update (postponed for the next particle manager update).
Declaration
[Unmanaged]
public void UpdateSimulation(bool singleFrame = false)
Parameters
System.Boolean
singleFrame
True if update animation by a single frame only (time time since last engine update), otherwise will update simulation with delta time since last update. |