Class ParticleManager
Class containing main settings for the TC Particle system
Inheritance
Fields
damping
Drag applied to particles. Specified in speed factor per second
Field Value
| Type | System.Single |
|---|
delay
Delay in seconds before systems starts playing when playOnAwake is true
Field Value
| Type | System.Single |
|---|
gravityMultiplier
The factor of gravity used as configured in the physics settings
Field Value
| Type | System.Single |
|---|
looping
Does the system loop
Field Value
| Type | System.Boolean |
|---|
MaxSpeed
Field Value
| Type | System.Single |
|---|
playbackSpeed
Field Value
| Type | System.Single |
|---|
playOnAwake
Should the system start playing as soon as it wakes up
Field Value
| Type | System.Boolean |
|---|
prewarm
Should the particles be prewarmed when starting playback
Field Value
| Type | System.Boolean |
|---|
Properties
ComputeShader
The compute shader used by TC Particles. Can be used to set custom values
| Type | UnityEngine.ComputeShader |
|---|
ConstantForce
Gravity of the particle system in world space
| Type | Vector3Curve |
|---|
DispatchCount
Get the number of thread groups that should be dispatched in a TC Particles compute shader
Remarks
Only use in advanced use cases for the extension API. In most cases it is better to use the built in DispatchExtensionKernel(ComputeShader, Int32) method
| Type | System.Int32 |
|---|
Duration
Total duration the system plays, before looping or stopping.
| Type | System.Single |
|---|
EmissionRate
Number of particles emitted each second
| Type | System.Single |
|---|
IsPaused
Is the particle system currently paused?
| Type | System.Boolean |
|---|
IsPlaying
Is the particle system playing?
| Type | System.Boolean |
|---|
IsStopped
Is the particle system currently stopped?
Remarks
This is only false when calling Stop(Boolean) and not when pausing.
| Type | System.Boolean |
|---|
IsWorldSpace
Is the current SimulationSpace set to World
| Type | System.Boolean |
|---|
MaxParticles
The maximum number of particles in the particle buffer (Read Only)
| Type | System.Int32 |
|---|
NoSimulation
Turn on/off no simulation. No simulation mode can be used for better performance of visualizations
| Type | System.Boolean |
|---|
ParticleCount
Current (approximate) particle count
Remarks
This is only approximate as it is not known exactly when particles die off. All particles are assumed to live the maximum set lifetime
| Type | System.Int32 |
|---|
ParticleTimeDelta
Delta time of particle simulation
| Type | System.Single |
|---|
RealTime
Time particle system has been playing since it is playing
| Type | System.Single |
|---|
SimulationSpace
The space the simulation takes place in.
Remarks
When setting this to a new space current particles are cleared
| Type | Space |
|---|
SystemTime
Current looped playback time
| Type | System.Single |
|---|
Methods
BindPariclesToKernel(ComputeShader, Int32)
Binds all fields needed to interface with the TC Particles API to a certain Compute shader kernel
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.ComputeShader | comp | |
| System.Int32 | kernel |
Clear(Boolean)
Clear all currently emitted particles
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | withChildren | Should children particle systems also be cleared |
DispatchExtensionKernel(ComputeShader, Int32)
Launch a compute shader kernel with a thread for each current particle
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.ComputeShader | extension | The compute shader to dispatch |
| System.Int32 | kernel | the kernel to dispatch in the compute shader |
Remarks
The extension compute shader must adhere to certain guidelines:
- Have a groupsize of (TC_GROUP_SIZE, 1, 1)
- Include TCFramework.cginc
- To get a particle use particles[GetID(dispatchThreadID.x)]
- Use the "_DeltTime" variable for calculations involving delta time
For more information see the additional comments in the extension kernel example
GetParticlesBuffer()
Get the buffer containing the current particles data
Returns
| Type | Description |
|---|---|
| UnityEngine.ComputeBuffer | Buffer with particle data |
Remarks
Only use in advanced use cases for the extension API. In most cases it is better to use the built in DispatchExtensionKernel(ComputeShader, Int32) method
IsAlive()
Are there any particles alive in the current system
Returns
| Type | Description |
|---|---|
| System.Boolean |
Pause(Boolean)
Pause current playback
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | withChildren | Should children particle systems be paused too |
Play(Boolean)
Start playback of the current system
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | withChildren | Should children system also start playback |
Simulate(Single, Boolean, Boolean)
Skip some time ahead by simulating the system for a given time
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | simulateTime | Time to skip ahead |
| System.Boolean | withChildren | Should children systems also be simulated with this system |
| System.Boolean | restart | Should the system be restarted before simulating |
Stop(Boolean)
Stop playback of particle system
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | withChildren | Should children systems also be stopped |