0
0
Unityframework~20 mins

Emission and shape modules in Unity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Particle System Mastery
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 Unity particle emission code?

Consider the following Unity C# code snippet that configures a particle system's emission module:

var ps = GetComponent<ParticleSystem>();
var emission = ps.emission;
emission.rateOverTime = 10f;
Debug.Log(emission.rateOverTime.constant);

What will be printed in the console?

Unity
var ps = GetComponent<ParticleSystem>();
var emission = ps.emission;
emission.rateOverTime = 10f;
Debug.Log(emission.rateOverTime.constant);
A10
B10.0f
C0
DError: Cannot access rateOverTime.constant
Attempts:
2 left
💡 Hint

Remember that rateOverTime is a MinMaxCurve and .constant returns the float value.

Predict Output
intermediate
2:00remaining
What shape does this Unity particle system use?

Given this code snippet configuring the shape module of a particle system:

var ps = GetComponent<ParticleSystem>();
var shape = ps.shape;
shape.shapeType = ParticleSystemShapeType.Cone;
shape.angle = 25f;
shape.radius = 0.5f;
Debug.Log(shape.shapeType);

What will be the output in the console?

Unity
var ps = GetComponent<ParticleSystem>();
var shape = ps.shape;
shape.shapeType = ParticleSystemShapeType.Cone;
shape.angle = 25f;
shape.radius = 0.5f;
Debug.Log(shape.shapeType);
ACone
BSphere
CCircle
DBox
Attempts:
2 left
💡 Hint

Look at the shapeType property assigned.

🔧 Debug
advanced
2:00remaining
Why does this emission rate code cause an error?

Examine this Unity C# code snippet:

var ps = GetComponent<ParticleSystem>();
var emission = ps.emission;
emission.rateOverTime = new ParticleSystem.MinMaxCurve(5f, 10f);
Debug.Log(emission.rateOverTime.constant);

What error will occur when running this code?

Unity
var ps = GetComponent<ParticleSystem>();
var emission = ps.emission;
emission.rateOverTime = new ParticleSystem.MinMaxCurve(5f, 10f);
Debug.Log(emission.rateOverTime.constant);
ANullReferenceException
BNo error, prints 5
CSyntaxError
DInvalidOperationException: Cannot access constant when curve mode is TwoConstants
Attempts:
2 left
💡 Hint

Check what happens when MinMaxCurve uses two constants.

🚀 Application
advanced
2:00remaining
How to configure a particle system to emit particles only from a sphere surface?

You want a Unity particle system to emit particles only from the surface of a sphere, not inside it. Which shape module settings achieve this?

ASet shapeType to Hemisphere and disable 'Emit from Shell' option
BSet shapeType to Sphere and set radius; disable 'Emit from Shell' option
CSet shapeType to Sphere and enable 'Emit from Shell' option
DSet shapeType to Cone and enable 'Emit from Shell' option
Attempts:
2 left
💡 Hint

Check the 'Emit from Shell' option in the shape module.

🧠 Conceptual
expert
2:00remaining
What is the effect of changing emission.rateOverTimeMultiplier at runtime?

In Unity, if you change emission.rateOverTimeMultiplier during gameplay, what happens to the particle system's emission?

AThe emission rate changes only after restarting the particle system
BThe emission rate instantly changes to the new multiplier times the base rate
CThe emission rate does not change at runtime
DChanging rateOverTimeMultiplier causes the particle system to stop emitting
Attempts:
2 left
💡 Hint

Think about how multipliers affect emission rate dynamically.