SParticleSystem
Dans cette classePlay
- Fonctions
- Play
- Stop
- Pause
- Clear
- Is
Alive - Emit
- Simulate
- Set
Trigger Particles - Get
Trigger Particles - Propriétés
- Start
Delay - Is
Playing - Is
Emitting - Is
Stopped - Is
Paused - Loop
- Play
On Awake - Time
- Duration
- Playback
Speed - Particle
Count - Enable
Emission - Emission
Rate - Emission
Rate Over Time - Emission
Rate Over Distance - Start
Speed - Start
Size - Start
Color - Start
Rotation - Start
Rotation3D - Start
Lifetime - Gravity
Modifier - Max
Particles - Random
Seed - Use
Auto Random Seed - Game
Object
| Fonction | Play | Sets the Particle Systems into play mode and enables emitting (if it has been disabled). |
| Fonction | Stop | Stops playing the Particle System. |
| Fonction | Pause | Pauses the system so no new particles are emitted and the existing particles are not updated. |
| Fonction | Clear | Remove all particles in the Particle System. |
| Fonction | IsAlive | Returns True if the Particle System contains live particles or is still creating new particles. |
| Fonction | Emit | Emit 'count' particles immediately. |
| Fonction | Simulate | Fast-forwards the Particle System by simulating particles over 'time' seconds, then pauses it. |
| Fonction | SetTriggerParticles | Write modified particles back to the Particle System, during a call to OnParticleTrigger. type - Type of trigger to return particles for. sp -- Particle array |
| Fonction | GetTriggerParticles | Get the particles that met the condition in the particle trigger module. his method is typically called from MonoBehaviour.OnParticleTrigger in response to a trigger callback. |
| Propriété | StartDelay | Start delay in seconds. |
| Propriété | IsPlaying | Determines whether the Particle System is playing. |
| Propriété | IsEmitting | Determines whether the Particle System is emitting particles. |
| Propriété | IsStopped | Determines whether the Particle System is stopped. |
| Propriété | IsPaused | Determines whether the Particle System is paused. |
| Propriété | Loop | Specifies whether the Particle System is looping. |
| Propriété | PlayOnAwake | If set to true, the Particle System will automatically start playing on startup. |
| Propriété | Time | Playback position in seconds. |
| Propriété | Duration | The duration of the Particle System in seconds. |
| Propriété | PlaybackSpeed | The playback speed of the Particle System. 1 is normal playback speed. |
| Propriété | ParticleCount | The current number of particles. |
| Propriété | EnableEmission | When set to false, the Particle System will not emit particles. |
| Propriété | EmissionRate | The rate of particle emission. |
| Propriété | EmissionRateOverTime | The rate at which the emitter spawns new particles over time. |
| Propriété | EmissionRateOverDistance | The rate at which the emitter spawns new particles over distance. |
| Propriété | StartSpeed | The initial speed of particles when the Particle System first spawns them. |
| Propriété | StartSize | The initial size of particles when the Particle System first spawns them. |
| Propriété | StartColor | The initial color of particles when the Particle System first spawns them. |
| Propriété | StartRotation | The initial rotation of particles when emitted. |
| Propriété | StartRotation3D | The initial 3D rotation of particles when emitted. |
| Propriété | StartLifetime | The total lifetime in seconds that particles will have when emitted. |
| Propriété | GravityModifier | A scale that this Particle System applies to gravity. |
| Propriété | MaxParticles | The maximum number of particles to emit. |
| Propriété | RandomSeed | Override the random seed used for the Particle System emission. |
| Propriété | UseAutoRandomSeed | Controls whether the Particle System uses an automatically-generated random number to seed the random number generator. |
| Propriété | GameObject | – |
Fonctions
Play
Sets the Particle Systems into play mode and enables emitting (if it has been disabled).
If the Particle System has been paused, then this resumes playing from the previous time. If the Particle System has stopped, then the system starts from time 0, and, if it is relevant, the startDelay is applied. Parameter withChildren: Plays all child Particle Systems as well.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| withChildren | bool | – |
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.ParticleSystem.Play()
--or
Space.Host.ExecutingObject.ParticleSystem.Play(true)
Stop
Stops playing the Particle System. Parameter withChildren: Plays all child Particle Systems as well.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| withChildren | bool | – |
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.ParticleSystem.Stop()
--or
Space.Host.ExecutingObject.ParticleSystem.Stop(true)
Pause
Pauses the system so no new particles are emitted and the existing particles are not updated. Parameter: withChildren: Pauses all child Particle Systems as well.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| withChildren | bool | – |
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.ParticleSystem.Pause()
--or
Space.Host.ExecutingObject.ParticleSystem.Pause(true)
Clear
Remove all particles in the Particle System.
This method also removes the particles from any linked sub-emitters. Use the withChildren parameter to remove particles from child Particle Systems that are not sub-emitters of the system.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| withChildren | bool | – |
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.ParticleSystem.Clear()
--or
Space.Host.ExecutingObject.ParticleSystem.Clear(true)
IsAlive
Returns True if the Particle System contains live particles or is still creating new particles. False if the Particle System has stopped emitting particles and all particles are dead. Parameter withChildren: checks all child Particle Systems as well.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| withChildren | bool | – |
Valeurs de retour
bool
Exemple
isAlive = Space.Host.ExecutingObject.ParticleSystem.IsAlive()
--or
isAlive = Space.Host.ExecutingObject.ParticleSystem.IsAlive(true)
Emit
Emit 'count' particles immediately.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| count | int | – |
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.ParticleSystem.Emit(100)
Simulate
Fast-forwards the Particle System by simulating particles over 'time' seconds, then pauses it.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| time | float | – |
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.ParticleSystem.Simulate(5.0)
SetTriggerParticles
Write modified particles back to the Particle System, during a call to OnParticleTrigger. type - Type of trigger to return particles for. sp -- Particle array
Paramètres
| Paramètre | Type | Description |
|---|---|---|
| type | int | Type of trigger to return particles for. |
| sp | SParticle[] | A table of SParticle |
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.ParticleSystem.SetTriggerParticles(0,ParticlesArray)
GetTriggerParticles
Get the particles that met the condition in the particle trigger module. his method is typically called from MonoBehaviour.OnParticleTrigger in response to a trigger callback.
Paramètres
| Paramètre | Type | Description |
|---|---|---|
| type | int | Type of trigger to return particles for. |
Valeurs de retour
SParticle[]
Exemple
ParticlesArray = Space.Host.ExecutingObject.ParticleSystem.GetTriggerParticles(0)
Propriétés
StartDelay
Start delay in seconds. Use this to delay when playback starts on the system.
Exemple
Space.Host.ExecutingObject.ParticleSystem.StartDelay = 5
IsPlayingLecture seule
Determines whether the Particle System is playing.
Exemple
isPlaying = Space.Host.ExecutingObject.ParticleSystem.IsPlaying
IsEmittingLecture seule
Determines whether the Particle System is emitting particles. A Particle System may stop emitting when its emission module has finished, it has been paused or if the system has been stopped.
Exemple
isEmitting = Space.Host.ExecutingObject.ParticleSystem.IsEmitting
IsStoppedLecture seule
Determines whether the Particle System is stopped.
Exemple
isStopped = Space.Host.ExecutingObject.ParticleSystem.IsStopped
IsPausedLecture seule
Determines whether the Particle System is paused.
Exemple
isPaused = Space.Host.ExecutingObject.ParticleSystem.IsPaused
Loop
Specifies whether the Particle System is looping. If you disable looping on a playing Particle System, it stops at the end of the current loop.
Exemple
Space.Host.ExecutingObject.ParticleSystem.Loop = true
PlayOnAwake
If set to true, the Particle System will automatically start playing on startup. Note that this setting is shared between all Particle Systems in the current particle effect.
Exemple
Space.Host.ExecutingObject.ParticleSystem.PlayOnAwake
Time
Playback position in seconds. Use this to read current playback time or to seek to a new playback time.
Exemple
Space.Host.ExecutingObject.ParticleSystem.Time = 5.0
DurationLecture seule
The duration of the Particle System in seconds.
Exemple
duration = Space.Host.ExecutingObject.ParticleSystem.Duration
PlaybackSpeed
The playback speed of the Particle System. 1 is normal playback speed.
Exemple
Space.Host.ExecutingObject.ParticleSystem.PlaybackSpeed = 1.5
ParticleCountLecture seule
The current number of particles.
Exemple
count = Space.Host.ExecutingObject.ParticleSystem.ParticleCount
EnableEmission
When set to false, the Particle System will not emit particles.
Exemple
Space.Host.ExecutingObject.ParticleSystem.EnableEmission = true
EmissionRate
The rate of particle emission.
Exemple
Space.Host.ExecutingObject.ParticleSystem.EmissionRate = 10
EmissionRateOverTime
The rate at which the emitter spawns new particles over time.
Exemple
Space.Host.ExecutingObject.ParticleSystem.EmissionRateOverTime = 10
EmissionRateOverDistance
The rate at which the emitter spawns new particles over distance. The emitter only spawns new particles when it moves.
Exemple
Space.Host.ExecutingObject.ParticleSystem.EmissionRateOverDistance = 10
StartSpeed
The initial speed of particles when the Particle System first spawns them.
Exemple
Space.Host.ExecutingObject.ParticleSystem.StartSpeed = 10
StartSize
The initial size of particles when the Particle System first spawns them.
Exemple
Space.Host.ExecutingObject.ParticleSystem.StartSize = 1.2
StartColor
The initial color of particles when the Particle System first spawns them.
Exemple
Space.Host.ExecutingObject.ParticleSystem.StartColor = Color.Red
StartRotation
The initial rotation of particles when emitted. When using curves, this value acts as a scale on the curve. Note that the value should be given in radians.
Exemple
Space.Host.ExecutingObject.ParticleSystem.StartRotation = 20.5
StartRotation3D
The initial 3D rotation of particles when emitted. When using curves, this value acts as a scale on the curves. Note that the values are Euler angles and should be given in radians.
Exemple
Space.Host.ExecutingObject.ParticleSystem.StartRotation3D = Vector.New(0,20,20)
StartLifetime
The total lifetime in seconds that particles will have when emitted. When using curves, this value acts as a scale on the curve. This value is set in the particle when it is created by the Particle System.
Exemple
Space.Host.ExecutingObject.ParticleSystem.StartLifetime = 20
GravityModifier
A scale that this Particle System applies to gravity.
Exemple
Space.Host.ExecutingObject.ParticleSystem.GravityModifier = 1.2
MaxParticles
The maximum number of particles to emit.
Exemple
Space.Host.ExecutingObject.ParticleSystem.MaxParticles = 500
RandomSeed
Override the random seed used for the Particle System emission.
Exemple
Space.Host.ExecutingObject.ParticleSystem.RandomSeed = 23423423
spawningparticles = Space.Scene.Find("Particles")
--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set random seed.
particles.UseAutoRandomSeed = false
particles.RandomSeed = 123456
UseAutoRandomSeed
Controls whether the Particle System uses an automatically-generated random number to seed the random number generator. If set to true, the Particle System will generate a new random seed each time it is played. If set to false, ParticleSystem.randomSeed will be used instead, allowing for a constant seed (useful if you want your particles to play in exactly the same way each time) or user-defined random value (for example, you may want to cycle through an array of seeds).
Exemple
Space.Host.ExecutingObject.ParticleSystem.UseAutoRandomSeed = true
GameObjectLecture seule
Exemple
theGameObject = Space.Host.ExecutingObject.ParticleSystem.GameObject



