Bird
Raised Fist0
Unityframework~10 mins

Emission and shape modules in Unity - Step-by-Step Execution

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Concept Flow - Emission and shape modules
Start Particle System
Emission Module
Calculate Emission Rate
Shape Module
Determine Particle Spawn Position
Spawn Particle
Repeat per frame
The particle system starts, emission module sets how many particles to create, shape module decides where they appear, then particles spawn and the cycle repeats.
Execution Sample
Unity
var ps = GetComponent<ParticleSystem>();
var emission = ps.emission;
emission.rateOverTime = 10f;
var shape = ps.shape;
shape.shapeType = ParticleSystemShapeType.Cone;
ps.Play();
This code sets the particle system to emit 10 particles per second from a cone shape and starts the system.
Execution Table
StepActionEmission RateShape TypeParticle Spawn PositionOutput
1Initialize Particle SystemDefault (varies)Default (varies)DefaultNo particles yet
2Set emission.rateOverTime = 1010 particles/secDefaultDefaultPrepare to emit 10 particles per second
3Set shape.shapeType = Cone10 particles/secConePositions inside cone volumeParticles will spawn inside cone
4Call ps.Play()10 particles/secConePositions inside cone volumeParticle system starts emitting
5Frame 1: Emit particles10 particles/secConeRandom position in coneParticles appear at cone positions
6Frame 2: Emit particles10 particles/secConeRandom position in coneMore particles appear
7Repeat emission each frame10 particles/secConeRandom position in coneContinuous particle emission
8Stop or disable system0 particles/secConeNo spawnEmission stops
💡 Emission stops when particle system is stopped or emission rate set to zero
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 5Final
emission.rateOverTimeDefault1010101010
shape.shapeTypeDefaultDefaultConeConeConeCone
particle spawn positionDefaultDefaultInside coneInside coneInside cone (varies)Inside cone (varies)
Key Moments - 3 Insights
Why do particles appear at different positions each frame even though the shape is fixed?
Because the shape module defines a volume (like a cone), particles spawn at random positions inside that volume each frame, as shown in execution_table rows 5 and 6.
What happens if emission.rateOverTime is set to zero after starting the system?
Emission stops immediately, so no new particles spawn, as shown in execution_table row 8.
Does changing the shape module after starting the system affect already spawned particles?
No, changing the shape affects only where new particles spawn, not existing ones, as seen between steps 3 and 5.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the emission rate after step 3?
A10 particles per second
B0 particles per second
CDefault emission rate
DEmission stopped
💡 Hint
Check the 'Emission Rate' column at step 3 in the execution_table.
At which step does the particle system start emitting particles?
AStep 2
BStep 4
CStep 1
DStep 8
💡 Hint
Look for the action 'Call ps.Play()' in the execution_table.
If the shape type is changed to Sphere after step 3, how would the particle spawn position change?
AParticles spawn at a single point
BParticles spawn inside a cone volume
CParticles spawn inside a sphere volume
DParticles stop spawning
💡 Hint
Refer to the 'Shape Type' and 'Particle Spawn Position' columns in the execution_table.
Concept Snapshot
Particle System Emission and Shape Modules:
- Emission module controls how many particles spawn per second.
- Shape module controls where particles appear (volume shape).
- Set emission.rateOverTime to control rate.
- Set shape.shapeType to control spawn area.
- Call Play() to start emitting particles.
Full Transcript
This visual execution shows how Unity's particle system uses emission and shape modules. First, the particle system is initialized with default settings. Then, the emission rate is set to 10 particles per second. Next, the shape module is set to a cone shape, which means particles will spawn inside a cone volume. When Play() is called, the system starts emitting particles at random positions inside the cone. Each frame, more particles spawn inside this volume. Emission stops when the system is stopped or the emission rate is set to zero. Variables like emission rate and shape type change step by step, affecting how and where particles appear. Key moments clarify why particles spawn at different positions and how changing settings affects emission. The quiz tests understanding of emission rate, start of emission, and shape effects.

Practice

(1/5)
1. What does the Emission module in Unity's Particle System control?
easy
A. How many particles are created and when they appear
B. The color of the particles
C. The size of the particles
D. The speed of the particles

Solution

  1. Step 1: Understand the role of Emission module

    The Emission module controls the rate and timing of particle creation in Unity's Particle System.
  2. Step 2: Compare with other options

    Color, size, and speed are controlled by other modules like Color over Lifetime or Size over Lifetime, not Emission.
  3. Final Answer:

    How many particles are created and when they appear -> Option A
  4. Quick Check:

    Emission = particle count and timing [OK]
Hint: Emission = particle count and timing control [OK]
Common Mistakes:
  • Confusing Emission with Color or Size modules
  • Thinking Emission controls particle speed
  • Assuming Emission controls particle shape
2. Which of the following is the correct way to enable the Emission module in a Unity Particle System script?
easy
A. var emission = particleSystem.emission; emission.enabled = true;
B. particleSystem.Emission.enabled = true;
C. particleSystem.emission.enable = true;
D. particleSystem.enableEmission = true;

Solution

  1. Step 1: Recall correct syntax for Emission module access

    In Unity, the Emission module is accessed via particleSystem.emission, which returns a struct with an enabled property.
  2. Step 2: Check each option's syntax

    var emission = particleSystem.emission; emission.enabled = true; correctly stores emission module and sets enabled to true. Options B, C, and D use incorrect property names or casing.
  3. Final Answer:

    var emission = particleSystem.emission; emission.enabled = true; -> Option A
  4. Quick Check:

    Correct property is emission.enabled [OK]
Hint: Use particleSystem.emission.enabled to toggle emission [OK]
Common Mistakes:
  • Using wrong property names like enable or enableEmission
  • Incorrect capitalization of 'emission'
  • Trying to set emission directly without storing it first
3. Given this code snippet in Unity:
var shape = particleSystem.shape;
shape.shapeType = ParticleSystemShapeType.Cone;
shape.angle = 25f;
shape.radius = 0.5f;
What effect does this code have on the particle system's shape module?
medium
A. Particles emit from a box with size 25 by 0.5
B. Particles emit from a sphere with radius 0.5
C. Particles emit from a cone shape with a 25-degree angle and 0.5 radius
D. Particles emit from a circle with 25 radius

Solution

  1. Step 1: Identify the shape type set

    The code sets shape.shapeType to ParticleSystemShapeType.Cone, so particles emit from a cone.
  2. Step 2: Understand angle and radius properties

    Angle sets the cone's spread to 25 degrees, radius sets the base radius to 0.5 units.
  3. Final Answer:

    Particles emit from a cone shape with a 25-degree angle and 0.5 radius -> Option C
  4. Quick Check:

    shapeType = Cone, angle = 25, radius = 0.5 [OK]
Hint: Cone shape uses angle and radius properties [OK]
Common Mistakes:
  • Confusing cone with sphere or circle
  • Misunderstanding angle as radius
  • Assuming radius applies to box shape
4. What is wrong with this code snippet that tries to enable emission in Unity?
particleSystem.emission.enabled = true;
medium
A. The code is correct and will enable emission
B. You cannot set emission.enabled directly; you must store the emission module first
C. The emission module is read-only and cannot be enabled
D. The property 'enabled' does not exist on emission

Solution

  1. Step 1: Understand emission module struct behavior

    Emission is a struct returned by particleSystem.emission; you must store it in a variable before modifying properties.
  2. Step 2: Explain why direct assignment fails

    Directly setting particleSystem.emission.enabled causes a compile error because emission returns a copy, not a reference.
  3. Final Answer:

    You cannot set emission.enabled directly; you must store the emission module first -> Option B
  4. Quick Check:

    Store emission module before setting enabled [OK]
Hint: Always assign emission module to variable before changing enabled [OK]
Common Mistakes:
  • Trying to set emission.enabled directly
  • Assuming emission is a reference type
  • Ignoring compiler errors about property assignment
5. You want to create a particle effect where particles emit only from the edges of a circle shape and appear in bursts of 10 particles every 2 seconds. Which combination of Emission and Shape module settings achieves this?
hard
A. Set Emission rate over time to 5; set Shape to Sphere with radius 1.
B. Set Emission rate over time to 0; set Shape to Box with size 1.
C. Set Emission rate over time to 10; set Shape to Cone with angle 360.
D. Set Emission rate over time to 0, enable bursts with count 10 every 2 seconds; set Shape to Circle with 'arcMode' set to 'Edge'.

Solution

  1. Step 1: Configure Emission for bursts

    Setting Emission rate over time to 0 stops continuous emission. Adding bursts with 10 particles every 2 seconds creates the desired burst effect.
  2. Step 2: Configure Shape for edge emission

    Setting Shape to Circle and using 'arcMode' as 'Edge' makes particles emit only from the circle's edge, not inside.
  3. Final Answer:

    Set Emission rate over time to 0, enable bursts with count 10 every 2 seconds; set Shape to Circle with 'arcMode' set to 'Edge'. -> Option D
  4. Quick Check:

    Bursts + Circle edge emission = desired effect [OK]
Hint: Use bursts for timing and circle edge for emission location [OK]
Common Mistakes:
  • Using continuous emission instead of bursts
  • Choosing wrong shape like sphere or box
  • Not setting arcMode to Edge for circle shape