0
0
Unityframework~10 mins

Visual effect examples (fire, smoke, sparkle) in Unity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start the fire particle effect.

Unity
ParticleSystem fireEffect = GetComponent<ParticleSystem>();
fireEffect.[1]();
Drag options to blanks, or click blank then click option'
APause
BStop
CPlay
DClear
Attempts:
3 left
💡 Hint
Common Mistakes
Using Stop() instead of Play() will prevent the effect from showing.
2fill in blank
medium

Complete the code to change the smoke particle system's emission rate.

Unity
var emission = smokeEffect.emission;
emission.[1].constant = 50f;
Drag options to blanks, or click blank then click option'
ArateOverTime
Brate
Cenabled
Dshape
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to set rate directly causes errors because it's inside the emission module.
3fill in blank
hard

Fix the error in the sparkle effect color change code.

Unity
var main = sparkleEffect.[1];
main.startColor = Color.yellow;
Drag options to blanks, or click blank then click option'
Arenderer
Bemission
Cshape
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using emission or shape modules will cause errors when setting startColor.
4fill in blank
hard

Fill both blanks to create a sparkle effect that plays and stops correctly.

Unity
ParticleSystem sparkle = GetComponent<ParticleSystem>();
sparkle.[1]();
sparkle.[2]();
Drag options to blanks, or click blank then click option'
APlay
BStop
CPause
DClear
Attempts:
3 left
💡 Hint
Common Mistakes
Using Pause() instead of Stop() will only pause the effect, not stop it.
5fill in blank
hard

Fill all three blanks to create a dictionary of effects with their names and play the fire effect.

Unity
var effects = new Dictionary<string, ParticleSystem> {
    {"fire", [1],
    {"smoke", [2],
    {"sparkle", [3]
};
effects["fire"].Play();
Drag options to blanks, or click blank then click option'
AfireEffect
BsmokeEffect
CsparkleEffect
DparticleEffect
Attempts:
3 left
💡 Hint
Common Mistakes
Using an undefined variable like particleEffect will cause errors.