0
0
Unityframework~15 mins

Sub-emitters in Unity - Deep Dive

Choose your learning style9 modes available
Overview - Sub-emitters
What is it?
Sub-emitters are special particle systems that are triggered by events in a main particle system, such as when a particle is born, dies, or collides. They allow you to create complex visual effects by chaining multiple particle systems together. This means one particle system can cause another to start, making effects like explosions with sparks or smoke more dynamic and realistic.
Why it matters
Without sub-emitters, creating detailed particle effects would require manually timing and controlling many separate particle systems, which is hard and error-prone. Sub-emitters automate this process, making effects more natural and easier to manage. This improves game visuals and performance by keeping related effects connected and synchronized.
Where it fits
Before learning sub-emitters, you should understand basic Unity particle systems and how to create simple effects. After mastering sub-emitters, you can explore advanced particle system features like custom shaders, particle collisions, and performance optimization.
Mental Model
Core Idea
Sub-emitters are like fireworks that launch smaller fireworks when they explode, creating a chain of effects triggered by particle events.
Think of it like...
Imagine a birthday cake with candles. When you blow out one candle (main particle), it sparks smaller candles (sub-emitters) to light up, creating a beautiful chain reaction of lights.
Main Particle System
  │
  ├─ On Birth ──▶ Sub-emitter A (e.g., sparks)
  │
  ├─ On Death ──▶ Sub-emitter B (e.g., smoke)
  │
  └─ On Collision ─▶ Sub-emitter C (e.g., sparks flying)

Each arrow shows when a sub-emitter triggers based on main particle events.
Build-Up - 7 Steps
1
FoundationUnderstanding Basic Particle Systems
🤔
Concept: Learn what a particle system is and how it creates visual effects using many small particles.
A particle system in Unity emits many tiny images or shapes called particles. These particles can move, change color, size, and disappear over time. For example, a fire effect uses many small orange and yellow particles that flicker and fade.
Result
You can create simple effects like smoke, fire, or rain by adjusting particle system settings.
Knowing how a single particle system works is essential before combining multiple systems with sub-emitters.
2
FoundationEvents That Trigger Particle Actions
🤔
Concept: Particles can trigger events like birth, death, or collision, which can be used to start other effects.
Each particle in a system has a life cycle: it is born, moves, and then dies. It can also collide with objects. Unity lets you detect these events to trigger actions. For example, when a particle dies, you might want to create a puff of smoke.
Result
You understand that particle events can be hooks to start new effects.
Recognizing particle events as triggers opens the door to chaining effects dynamically.
3
IntermediateIntroducing Sub-emitters in Unity
🤔
Concept: Sub-emitters are particle systems linked to main particles that start on specific events like birth, death, or collision.
In Unity's Particle System component, you can add sub-emitters under the 'Sub Emitters' module. You assign another particle system to trigger when a particle is born, dies, or collides. For example, sparks can be sub-emitters triggered on collision to simulate sparks flying off.
Result
You can create layered effects where one particle system causes another to start automatically.
Using sub-emitters simplifies complex effects by automating the start of related particle systems.
4
IntermediateConfiguring Sub-emitter Events and Settings
🤔Before reading on: Do you think sub-emitters can trigger on multiple events simultaneously or only one event per sub-emitter? Commit to your answer.
Concept: Learn how to set which event triggers a sub-emitter and how to control its behavior.
Each sub-emitter can be set to trigger on one event: birth, death, or collision. You can add multiple sub-emitters to cover different events. You also control if the sub-emitter inherits velocity or color from the parent particle, affecting realism.
Result
You can fine-tune how and when sub-emitters activate, making effects more natural.
Understanding event-specific triggers and inheritance lets you create believable chained effects.
5
IntermediatePractical Example: Explosion with Sparks and Smoke
🤔Before reading on: Will adding sub-emitters increase or decrease the performance cost of your particle effect? Commit to your answer.
Concept: Apply sub-emitters to build a multi-stage explosion effect with sparks on collision and smoke on death.
Create a main explosion particle system. Add a sub-emitter for sparks triggered on collision, so sparks fly when particles hit surfaces. Add another sub-emitter for smoke triggered on death, so smoke appears as particles vanish. Adjust sizes and colors for realism.
Result
You get a dynamic explosion effect where sparks and smoke appear naturally without manual timing.
Seeing sub-emitters in action clarifies how they automate complex visual storytelling in effects.
6
AdvancedPerformance Considerations and Optimization
🤔Before reading on: Do you think using many sub-emitters always improves performance? Commit to your answer.
Concept: Learn how sub-emitters affect performance and how to optimize particle systems in production.
Each sub-emitter adds more particles and calculations, which can slow down your game if overused. Use sub-emitters sparingly and limit particle counts. Use GPU particle systems when possible. Also, disable sub-emitters when not visible to save resources.
Result
You can balance visual quality and performance by smart use of sub-emitters.
Knowing the cost of sub-emitters helps prevent slowdowns and keeps games running smoothly.
7
ExpertAdvanced Control with Scripts and Custom Events
🤔Before reading on: Can sub-emitters be triggered manually via code, or only through built-in particle events? Commit to your answer.
Concept: Explore how to control sub-emitters beyond built-in events using scripting for custom behaviors.
Unity allows you to control particle systems via scripts. You can start or stop sub-emitters manually or trigger them based on game logic, not just particle events. This enables effects like conditional explosions or chaining effects based on player actions. You can also modify sub-emitter parameters at runtime for dynamic visuals.
Result
You gain full control over sub-emitters, enabling complex, interactive effects.
Understanding script control unlocks creative possibilities beyond default particle event triggers.
Under the Hood
Sub-emitters work by listening to specific events in the main particle system's lifecycle. When a particle is born, dies, or collides, the main system signals the sub-emitter to emit its own particles. Internally, Unity manages these linked systems so that sub-emitters inherit properties like position and velocity from the triggering particle, ensuring smooth visual continuity.
Why designed this way?
Sub-emitters were designed to simplify creating complex chained effects without manually syncing multiple particle systems. This design reduces developer effort and errors while improving performance by tightly coupling related effects. Alternatives like manually triggering separate systems were error-prone and harder to maintain.
Main Particle System
┌─────────────────────────────┐
│ Particle Lifecycle Events    │
│ ┌───────────────┐           │
│ │ Birth Event   │───────────┼─────▶ Sub-emitter A
│ ├───────────────┤           │
│ │ Death Event   │───────────┼─────▶ Sub-emitter B
│ ├───────────────┤           │
│ │ Collision     │───────────┼─────▶ Sub-emitter C
│ └───────────────┘           │
└─────────────────────────────┘

Sub-emitters inherit position, velocity, and optionally color from triggering particles.
Myth Busters - 4 Common Misconceptions
Quick: Do sub-emitters always improve performance because they automate effects? Commit to yes or no.
Common Belief:Sub-emitters always make particle effects more efficient and faster.
Tap to reveal reality
Reality:Sub-emitters add more particles and processing, which can decrease performance if overused or not optimized.
Why it matters:Ignoring performance impact can cause frame rate drops and poor game experience.
Quick: Can a single sub-emitter respond to multiple events like birth and death simultaneously? Commit to yes or no.
Common Belief:One sub-emitter can trigger on multiple particle events at once.
Tap to reveal reality
Reality:Each sub-emitter can only be assigned to one event type; to cover multiple events, you need multiple sub-emitters.
Why it matters:Misunderstanding this leads to missing effects or unexpected behavior in particle chains.
Quick: Are sub-emitters only visual and cannot be controlled by scripts? Commit to yes or no.
Common Belief:Sub-emitters can only be triggered automatically by particle events and cannot be controlled manually.
Tap to reveal reality
Reality:Sub-emitters can be controlled and triggered via scripts for advanced, dynamic effects beyond automatic events.
Why it matters:Believing this limits creative use and interactive effect design.
Quick: Does a sub-emitter always inherit all properties from the parent particle? Commit to yes or no.
Common Belief:Sub-emitters inherit all properties like color, velocity, and size from the triggering particle by default.
Tap to reveal reality
Reality:Inheritance is optional and configurable; some properties may not be inherited unless explicitly set.
Why it matters:Assuming full inheritance can cause unexpected visual results or bugs.
Expert Zone
1
Sub-emitters can inherit velocity and color selectively, allowing fine control over how child particles behave relative to their parent.
2
Multiple sub-emitters can be stacked on a single particle system, each responding to different events, enabling complex multi-stage effects.
3
Using GPU particle systems with sub-emitters requires careful setup because not all features are supported, affecting performance and visuals.
When NOT to use
Avoid sub-emitters when you need completely independent particle systems with no event linkage or when performance is critical and simpler effects suffice. Instead, use separate particle systems triggered by game logic or animation events.
Production Patterns
In games, sub-emitters are used for effects like explosions with sparks and smoke, magic spells with trailing particles, and environmental effects like leaves falling and scattering dust. Professionals combine sub-emitters with scripting to create responsive, interactive visuals tied to gameplay.
Connections
Event-driven programming
Sub-emitters rely on events (birth, death, collision) to trigger actions, similar to event-driven code that reacts to user input or system changes.
Understanding event-driven programming helps grasp how sub-emitters respond automatically to particle lifecycle events without manual polling.
Chain reactions in chemistry
Sub-emitters create chain reactions where one event triggers another, like chemical reactions where one molecule's change causes others to react.
Seeing sub-emitters as chain reactions clarifies how small triggers can create complex, cascading effects.
Modular design in engineering
Sub-emitters embody modular design by linking small, reusable particle systems to build complex effects without monolithic code.
Recognizing modularity in sub-emitters encourages building maintainable and scalable visual effects.
Common Pitfalls
#1Adding too many sub-emitters without performance checks
Wrong approach:MainParticleSystem.subEmitters.Add(sparksEmitter); MainParticleSystem.subEmitters.Add(smokeEmitter); MainParticleSystem.subEmitters.Add(extraEmitter); // No limit or optimization
Correct approach:Use only necessary sub-emitters and optimize particle counts: if (performanceIsGood) { MainParticleSystem.subEmitters.Add(sparksEmitter); MainParticleSystem.subEmitters.Add(smokeEmitter); }
Root cause:Assuming more sub-emitters always improve visuals without considering performance impact.
#2Assigning one sub-emitter to multiple events expecting all to trigger
Wrong approach:MainParticleSystem.subEmitters.SetSubEmitter(0, sparksEmitter, ParticleSystemSubEmitterType.Birth); MainParticleSystem.subEmitters.SetSubEmitter(0, sparksEmitter, ParticleSystemSubEmitterType.Death); // overwrites previous
Correct approach:Assign separate sub-emitters for each event: MainParticleSystem.subEmitters.SetSubEmitter(0, sparksEmitter, ParticleSystemSubEmitterType.Birth); MainParticleSystem.subEmitters.SetSubEmitter(1, smokeEmitter, ParticleSystemSubEmitterType.Death);
Root cause:Misunderstanding that one sub-emitter slot can only handle one event type.
#3Expecting sub-emitters to inherit all properties automatically
Wrong approach:SubEmitterModule.inheritColor = false; SubEmitterModule.inheritVelocity = false; // but expecting color and velocity inheritance anyway
Correct approach:Explicitly enable inheritance: SubEmitterModule.inheritColor = true; SubEmitterModule.inheritVelocity = true;
Root cause:Not configuring inheritance settings leads to unexpected visual differences.
Key Takeaways
Sub-emitters let one particle system trigger others on particle events, enabling complex chained effects.
They simplify creating dynamic visuals like explosions with sparks and smoke by automating effect timing.
Each sub-emitter triggers on only one event type, so multiple sub-emitters are needed for multiple triggers.
While powerful, sub-emitters add performance cost and should be used thoughtfully and optimized.
Advanced control via scripting unlocks interactive and conditional particle effects beyond automatic triggers.