0
0
Unityframework~20 mins

Particle System component in Unity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Particle System Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this Particle System emission rate code?

Consider this Unity C# script snippet that modifies a Particle System's emission rate over time. What will be the emission rate after 3 seconds?

Unity
using UnityEngine;

public class ParticleEmissionTest : MonoBehaviour
{
    public ParticleSystem ps;

    void Start()
    {
        var emission = ps.emission;
        emission.rateOverTime = 10f;
    }

    void Update()
    {
        var emission = ps.emission;
        emission.rateOverTime = 10f + Time.time * 5f;
    }
}
A10 particles per second
B15 particles per second
C25 particles per second
D30 particles per second
Attempts:
2 left
💡 Hint

Remember that Time.time gives the time in seconds since the game started.

🧠 Conceptual
intermediate
1:30remaining
Which property controls the shape of particle emission?

In Unity's Particle System component, which property lets you change the shape from which particles are emitted?

Ashape.shapeType
Bshape.enabled
Cmain.startSize
Demission.rateOverTime
Attempts:
2 left
💡 Hint

Think about the module that defines the geometry of emission.

🔧 Debug
advanced
2:00remaining
Why does this Particle System not emit particles?

Look at this code snippet. The Particle System does not emit any particles when the game runs. What is the cause?

Unity
using UnityEngine;

public class ParticleDebug : MonoBehaviour
{
    public ParticleSystem ps;

    void Start()
    {
        var emission = ps.emission;
        emission.enabled = false;
        ps.Play();
    }
}
AThe Particle System variable ps is not assigned.
BEmission is disabled, so no particles are emitted.
CParticle System is not playing because Play() is called in Start().
DThe emission rate is zero by default.
Attempts:
2 left
💡 Hint

Check the emission module's enabled state.

📝 Syntax
advanced
1:30remaining
Which code correctly sets the start color of a Particle System?

Choose the correct code snippet to set the start color of a Particle System to red.

A
var main = ps.main;
main.startColor = Color.red;
B
var main = ps.main;
main.startColor = new Color(1, 0, 0);
Cps.main.startColor = Color.red;
Dps.startColor = Color.red;
Attempts:
2 left
💡 Hint

The main module is a struct; you must assign its properties correctly.

🚀 Application
expert
3:00remaining
How to smoothly increase particle size over lifetime?

You want particles to start small and grow bigger smoothly as they live. Which code snippet achieves this effect?

A
var main = ps.main;
main.startSize = 1f;
var sizeOverLifetime = ps.sizeOverLifetime;
sizeOverLifetime.enabled = true;
sizeOverLifetime.size = new ParticleSystem.MinMaxCurve(1f, AnimationCurve.Linear(0, 1f, 1, 2f));
B
var sizeOverLifetime = ps.sizeOverLifetime;
sizeOverLifetime.enabled = true;
sizeOverLifetime.size = new ParticleSystem.MinMaxCurve(1f, AnimationCurve.Linear(0, 0.1f, 1, 1));
C
var sizeOverLifetime = ps.sizeOverLifetime;
sizeOverLifetime.enabled = true;
sizeOverLifetime.size = new ParticleSystem.MinMaxCurve(1f, AnimationCurve.Linear(0, 0.1f, 1, 1f));
D
var sizeOverLifetime = ps.sizeOverLifetime;
sizeOverLifetime.enabled = true;
sizeOverLifetime.size = new ParticleSystem.MinMaxCurve(1f, AnimationCurve.Linear(0, 1f, 1, 2f));
Attempts:
2 left
💡 Hint

Think about the size curve from 1 to 2 over the particle lifetime.