0
0
Unityframework~10 mins

Sub-emitters in Unity - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Sub-emitters
Start Particle System
Emit Main Particles
Check Sub-emitter Trigger
Emit Sub-emitter
Sub-emitter Particles
End
The main particle system emits particles. When a particle event occurs (like birth or death), the sub-emitter triggers and emits its own particles.
Execution Sample
Unity
void OnParticleTrigger() {
  var sub = mainParticleSystem.subEmitters;
  sub.EmitSubEmitter(0, 5);
}
When the main particle system triggers, it emits 5 particles from its first sub-emitter.
Execution Table
StepActionMain Particle CountSub-emitter TriggeredSub-emitter Particle Count
1Start main particle system0No0
2Main system emits 3 particles3No0
3Particle event triggers sub-emitter3Yes0
4Sub-emitter emits 5 particles3Yes5
5Main system emits 2 more particles5No5
6No new trigger, particles continue5No5
7End of simulation5No5
💡 Simulation ends after fixed steps; no more triggers.
Variable Tracker
VariableStartAfter Step 2After Step 4After Step 5Final
Main Particle Count03355
Sub-emitter Particle Count00555
Sub-emitter TriggeredNoNoYesNoNo
Key Moments - 2 Insights
Why does the sub-emitter only emit particles after a trigger event?
Sub-emitters are designed to emit particles only when a specific event occurs in the main system, like particle birth or death, as shown in step 3 and 4 of the execution_table.
Does the main particle count increase when the sub-emitter emits particles?
No, the main particle count and sub-emitter particle count are tracked separately, as seen in steps 4 and 5 where main count stays at 3 while sub-emitter emits 5 particles.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step does the sub-emitter first emit particles?
AStep 4
BStep 3
CStep 2
DStep 5
💡 Hint
Check the 'Sub-emitter Particle Count' column for when it changes from 0 to 5.
According to variable_tracker, what is the main particle count after step 5?
A3
B5
C0
D8
💡 Hint
Look at the 'Main Particle Count' row under 'After Step 5' column.
If the sub-emitter trigger never happens, what would the sub-emitter particle count be at the end?
A5
B3
C0
DCannot determine
💡 Hint
Refer to the 'Sub-emitter Particle Count' column in execution_table rows where 'Sub-emitter Triggered' is 'No'.
Concept Snapshot
Sub-emitters are particle systems triggered by events in a main particle system.
They emit particles only when triggered (e.g., on birth or death).
Main and sub-emitter particles are tracked separately.
Use subEmitters.EmitSubEmitter(index, count) to emit.
Useful for effects like sparks from explosions.
Full Transcript
This visual execution shows how a main particle system emits particles and triggers a sub-emitter to emit its own particles. The flow starts with the main system emitting particles. When a trigger event occurs, the sub-emitter activates and emits particles separately. The execution table tracks particle counts and trigger states step-by-step. Key moments clarify that sub-emitters only emit on events and do not increase main particle counts. The quiz tests understanding of when sub-emitters emit and particle counts at various steps. The snapshot summarizes usage and behavior of sub-emitters in Unity particle systems.