Course Content
Unity for Beginners
Unity for Beginners
Particles System
In Unity, a particle system is a powerful tool used for creating various visual effects such as fire, smoke, explosions, rain, sparks, and more. It's essentially a collection of small, simple objects (particles) that are generated and controlled dynamically to create complex effects.
When we create a particle system this is it’s interface in the inspector
Key properties:
Lifetime: Determines how long each particle exists before disappearing. Specified in seconds.
Start Color: Defines the initial color of particles when they are emitted. Can be a single color or a gradient, allowing for smooth color transitions.
Start Size: Specifies the initial size of particles upon emission. Size can be uniform for all particles or randomized within a range.
Start Speed: Sets the initial velocity of particles when they are emitted. Determines how fast particles move away from the emitter.
Rotation: Determines whether particles rotate and how they rotate over their lifetime. Rotation can add realism to effects like smoke, fire, or debris.
Emission
Rate Over Time: This property controls the number of particles emitted per second.
It's a straightforward way to adjust the density of particle effects.
For example, setting a rate of 10 particles per second means that every second, 10 new particles will be emitted from the emitter.
Bursts: Burst emission allows you to emit particles in bursts rather than continuously.
You can define specific intervals during which a large number of particles are emitted all at once.
This is useful for creating effects like explosions or sudden bursts of sparks.
Shape
Common Emission Shapes:
Point:
- Emit particles from a single point in space;
- Useful for creating effects like sparks, magic spells, or single-point explosions.
Sphere:
- Emit particles from a spherical volume;
- You can control the radius of the sphere, allowing for effects like smoke plumes or explosions that emanate outward in all directions.
Cone:
- Emit particles in a cone-shaped area;
- Parameters such as angle and length of the cone can be adjusted to control the spread and direction of particles;
- Useful for effects like gunfire, rocket thrusters, or directional sparks.
Box:
- Emit particles within a rectangular volume;
- You can specify the dimensions of the box along each axis, allowing for precise control over the shape and size of the emission area;
- Useful for effects like rain, snow, or debris falling within a confined area.
Mesh:
- Emit particles from the surface of a 3D mesh;
- Allows for more complex and customizable emission shapes based on the geometry of the mesh;
- Useful for effects like sparks emanating from a metal surface or leaves falling from trees.
Additional Options and Parameters:
Randomize Direction: Some emission shapes allow you to randomize the direction of emitted particles, adding variation and realism to the effect.
Spread: Controls the spread or divergence of emitted particles within the shape. Higher spread values result in particles being emitted in a wider area.
Controle particles with script:
In the Start()
method, the Play()
method is called on the my_particles
ParticleSystem component, causing it to start emitting particles.
Immediately after calling Play()
, the Stop()
method is called on the same my_particles
ParticleSystem component, causing it to stop emitting particles.
This is the official documentation from unity about the particles system: Particle System
Thanks for your feedback!