0
0
Unityframework~10 mins

Visual effect examples (fire, smoke, sparkle) in Unity - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Visual effect examples (fire, smoke, sparkle)
Start Unity Scene
Create Particle System
Choose Effect Type
Fire
Set Colors, Size, Speed
Play Effect in Scene
Effect Visible to Player
Loop or Stop Based on Settings
This flow shows how Unity creates visual effects by starting a particle system, selecting the effect type, setting properties, and playing it in the scene.
Execution Sample
Unity
using UnityEngine;

public class FireEffect : MonoBehaviour {
    void Start() {
        var ps = gameObject.AddComponent<ParticleSystem>();
        ps.Stop();
        var main = ps.main;
        main.startColor = Color.red;
        ps.Play();
    }
}
This code adds a fire-like particle system to a game object and sets its main color to red.
Execution Table
StepActionVariable/Property ChangedValueEffect
1Start Unity Scene--Scene loads, ready for effects
2Add ParticleSystem componentpsParticleSystem instanceParticle system created on object
3Access main modulemainParticleSystem.MainModuleMain settings accessible
4Set startColormain.startColorRedParticles will appear red (fire-like)
5Play particle systemps.isPlayingTrueParticles start emitting
6Effect visible--Red fire effect seen in scene
7Loop or stopps.main.loopTrue (default)Effect repeats until stopped
💡 Effect runs continuously until stopped or scene ends
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 5Final
psnullParticleSystem instanceParticleSystem instanceParticleSystem instanceParticleSystem playingParticleSystem playing
main.startColordefaultdefaultdefaultRedRedRed
ps.isPlayingFalseFalseFalseFalseTrueTrue
Key Moments - 3 Insights
Why do we need to access 'main' before setting startColor?
The 'main' variable accesses the main module of the particle system where properties like startColor are set. Without this, you cannot change the color. See execution_table step 3 and 4.
What happens if we don't call Play() on the particle system?
The particle system will not emit particles, so no visual effect appears. This is shown in execution_table step 5 where isPlaying changes to True to start emission.
Why does the effect keep repeating?
By default, the particle system's loop property is True, so it keeps playing until stopped or the scene ends. See execution_table step 7.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 4. What color is set for the particles?
ARed
BBlue
CGreen
DYellow
💡 Hint
Check the 'Value' column at step 4 in execution_table.
At which step does the particle system start emitting particles?
AStep 3
BStep 5
CStep 2
DStep 7
💡 Hint
Look for when 'ps.isPlaying' changes to True in execution_table.
If we set ps.loop to False, what will happen?
AEffect will play repeatedly
BEffect will never play
CEffect will play once and stop
DEffect color changes
💡 Hint
Refer to execution_table step 7 about looping behavior.
Concept Snapshot
Unity visual effects use Particle Systems.
Add ParticleSystem component to object.
Set properties like startColor in main module.
Call Play() to start effect.
Loop controls repetition.
Common effects: fire (red), smoke (gray), sparkle (bright).
Full Transcript
This visual execution shows how Unity creates simple visual effects like fire using particle systems. First, the scene starts and a ParticleSystem component is added to a game object. Then, the main module of the particle system is accessed to set properties such as the start color to red for a fire effect. The particle system is played to emit particles, making the effect visible in the scene. The system loops by default, so the effect repeats until stopped or the scene ends. Key points include accessing the main module before setting properties, calling Play() to start emission, and understanding the loop property controls repetition.