0
0
Unityframework~30 mins

Sub-emitters in Unity - Mini Project: Build & Apply

Choose your learning style9 modes available
Unity Particle System with Sub-emitters
📖 Scenario: You are creating a simple Unity particle effect where one particle system triggers another smaller particle system when particles die. This is useful for effects like sparks that burst when a firework particle disappears.
🎯 Goal: Build a Unity script that sets up a main particle system and adds a sub-emitter particle system that triggers on particle death.
📋 What You'll Learn
Create a main particle system GameObject called mainParticleSystem
Create a sub-emitter particle system GameObject called subEmitterSystem
Add the subEmitterSystem as a sub-emitter to mainParticleSystem triggered on particle death
Print a confirmation message when the sub-emitter is successfully added
💡 Why This Matters
🌍 Real World
Sub-emitters are used in games and simulations to create rich visual effects like explosions, sparks, and smoke that react dynamically.
💼 Career
Understanding particle systems and sub-emitters is important for game developers and visual effects artists working with Unity to create immersive experiences.
Progress0 / 4 steps
1
Create the main particle system GameObject
Create a variable called mainParticleSystem and assign it a new GameObject with a ParticleSystem component.
Unity
Need a hint?

Use new GameObject("MainParticleSystem").AddComponent<ParticleSystem>() to create the particle system.

2
Create the sub-emitter particle system GameObject
Create a variable called subEmitterSystem and assign it a new GameObject with a ParticleSystem component.
Unity
Need a hint?

Use new GameObject("SubEmitterSystem").AddComponent<ParticleSystem>() to create the sub-emitter.

3
Add the sub-emitter to the main particle system
Use mainParticleSystem.subEmitters.AddSubEmitter to add subEmitterSystem as a sub-emitter triggered on ParticleSystemSubEmitterType.Death with ParticleSystemSubEmitterProperties.InheritNothing.
Unity
Need a hint?

Use AddSubEmitter method with the correct parameters to link the sub-emitter.

4
Print confirmation message
Write a Debug.Log statement that prints "Sub-emitter added successfully!" inside the Start method after adding the sub-emitter.
Unity
Need a hint?

Use Debug.Log("Sub-emitter added successfully!") to print the message.