Introduction:
Welcome back to the second part of our Beginner’s Guide to Unity Particle System! In the previous article, we covered the basic settings of the particle system in Unity, including emission, shape, colour, and size. In this article, we will delve deeper into the advanced settings that will allow you to create more sophisticated and visually stunning particle effects in your Unity games.
1. Gravity Modifier:
One of the essential parameters in Unity’s particle system is the Gravity Modifier. This setting determines how much gravity affects the particles within the system. By default, the Gravity Modifier is set to 1, meaning particles will be influenced by the gravity defined in the Unity physics settings. However, you can adjust it to create unique particle behaviours.
To modify the Gravity Modifier, select your Particle System in the Unity editor. In the Inspector window, locate the Gravity Modifier parameter under the Simulation module. By decreasing the value below 1, you can reduce the impact of gravity on your particles, creating an anti-gravity effect. On the other hand, setting the value higher than 1 will intensify the gravitational pull and result in particles falling faster.
Experiment with different Gravity Modifier values to achieve the desired particle movement and defy gravity in your game’s visual effects.
2. Simulation Space:
Unity allows you to control how the particle system interacts with the game world by adjusting the Simulation Space parameter. This setting determines whether particle movement is calculated in Local, World, or Custom space.
When using Local space, the particles’ movement is relative to the position and rotation of the object to which the Particle System component is attached. This setting is useful for creating particle effects that are attached to specific game objects and move with them.
In World space, the particles’ movement is calculated independently of any game objects’ position or rotation. This option is suitable for particle effects that need to move freely in the game’s world, regardless of other objects’ motion.
Lastly, Custom space allows you to define a custom Transform for the particle system, making it possible to create more complex and specific particle behaviours. To choose the Custom space, you need to assign a Transform in the Custom Simulation Space field.
To adjust the Simulation Space of your particle system, go to the Inspector window, locate the Simulation Space parameter in the Main module, and choose between Local, World, or Custom.
By learning to control the Simulation Space, you can achieve precise and dynamic particle motion in your game.
3. Simulation Speed:
The Simulation Speed parameter is a vital setting to control the timing of your particle system’s simulation. It determines how fast or slow the particles animate within the system.
In the Inspector window, find the Simulation Speed parameter in the Main module. By default, it is set to 1, which means that the particles will animate at the standard speed defined by the Unity’s time scale. Increasing the Simulation Speed value will accelerate the animation, while decreasing it will slow it down.
Adjusting the Simulation Speed can help you achieve various effects, such as emphasizing the intensity of an explosion by speeding up the particles or creating a slow-motion visual effect by reducing the Simulation Speed.
4. Delta Time:
Delta Time plays a crucial role in maintaining smooth and consistent particle movement, regardless of the frame rate or performance fluctuations. Delta Time represents the time elapsed between the previous and current frame and is essential for synchronizing particle behavior with the game’s update loop.
In Unity, you can use two different types of Delta Time in your particle systems: Time.deltaTime and Time.unscaledDeltaTime.
Time.deltaTime is the default Delta Time and adjusts the particle behaviour proportionally to the frame rate. When the frame rate is high, the particle movements appear smoother, and vice versa. Using Time.deltaTime is suitable for most scenarios when you want the particle system to adapt to the game’s performance dynamically.
On the other hand, Time.unscaledDeltaTime is unaffected by the time scale and remains constant regardless of the frame rate. This type of Delta Time is primarily used in situations where you want consistent and uninterrupted particle movement, irrespective of performance fluctuations or time scale modifications.
To determine which Delta Time is appropriate for your project, consider the desired particle behaviour and how it should adapt to changes in frame rate or time scale. You can access Delta Time values by calling Time.deltaTime or Time.unscaledDeltaTime within your particle system scripts.
5. Scaling Mode:
The Scaling Mode parameter in Unity’s particle system defines how the particle size is affected by transformations applied to the emitter or the parent GameObject hierarchy.
The default scaling mode is Shape, where scaling in the emitter affects particle size. This means that if you scale the emitter, the particles’ size will adjust accordingly. However, if you have important transformations within the Game Object hierarchy affecting the particle system, you might want to change the Scaling Mode to Hierarchy.
In Hierarchy mode, particle size is influenced by the Game Object hierarchy scaling, rather than the emitter directly. This allows for more flexibility when scaling the entire system without affecting the size of individual particles.
Additionally, Unity offers Local Space as the third option for the Scaling Mode. With Local Space, particles are unaffected by any scaling changes and retain their initial size throughout the simulation. This mode can be useful when you want to maintain consistent particle size regardless of scaling adjustments.
To modify the Scaling Mode, locate the Scaling Mode parameter in the Renderer module of your particle system in the Inspector window. Experiment with the different modes to achieve the desired scaling behaviour for your particle effects.
6. Play on Awake:
The Play on Awake parameter determines whether the particle system automatically starts emitting particles when the scene starts or when the Game Object is created. By default, this parameter is checked, enabling automatic particle emission.
To disable the Play on Awake functionality, uncheck the Play on Awake checkbox in the Inspector window. This allows you to manually control when the particle system should start emitting particles using scripting or other triggers within the game.
7. Emitter Velocity Mode:
The Emitter Velocity Mode setting controls how the particle system calculates the initial velocity of emitted particles. By default, Unity uses the velocity of the particle system’s Transform to determine particle velocity. However, you can change this behaviour to use the velocity of a Unity Rigidbody or a custom Transform.
To modify the Emitter Velocity Mode, locate the Velocity Over Lifetime module in the Inspector window. In the Emitter Velocity Mode dropdown menu, you can choose between Rigidbody and Transform. Selecting Rigidbody allows you to attach a Rigidbody component to the particle system’s Game Object, enabling you to use the Rigidbody’s velocity for particle emission. Choosing Transform allows you to assign a custom Transform for the particle system to utilize as the velocity source.
Experiment with different Emitter Velocity Modes to achieve the desired particle emission behaviour, whether it’s based on the object’s overall velocity or a specific custom Transform.
8. Max Particles:
The Max Particles parameter determines the maximum number of particles that can be alive at any given time within the particle system. By default, Unity sets this value to 1000 particles. However, you can adjust it to optimize performance or increase the particle count for more visually compelling effects.
It’s important to find the right balance when setting the Max Particles value. If the value is too low, it could limit the number of visible particles, resulting in undesirable visual gaps or incomplete effects. On the other hand, a high Max Particles value can put a strain on performance and potentially lead to frame rate drops.
To modify the Max Particles setting, locate the Renderer module in the Inspector window. In the Particle System Renderer component, you will find the Max Particles field. Adjust the value according to your desired particle system performance and visual outcome.
9. Auto Random Seed:
The Auto Random Seed parameter determines whether the particle system generates a random seed upon start, ensuring that each simulation appears slightly different. By default, Auto Random Seed is enabled, resulting in unique particle behaviour each time the game starts. Disabling this option allows you to manually set a specific random seed.
To control the Auto Random Seed setting, locate the Particle System component in the Inspector window. Check or uncheck the Auto Random Seed checkbox according to your desired behaviour.
Setting a specific random seed can be useful when you need to ensure consistent particle simulations or to reproduce specific particle effects.
Summary:
In this second part of our Beginner’s Guide to Unity Particle System, we explored the advanced settings that allow for more sophisticated particle effects in Unity. We discussed Gravity Modifier, which controls the influence of gravity on the particles, and Simulation Space, which determines how particle movement is calculated in relation to the game world.
We also covered Simulation Speed, which governs the timing of particle animation, as well as Delta Time, which ensures smooth and consistent particle movement regardless of frame rate or performance fluctuations. Additionally, we discussed the Scaling Mode, which controls how particle size is affected by transformations, and the Play on Awake parameter, which determines automatic particle emission.
Furthermore, we explored Emitter Velocity Mode, which allows for more control over particle emission velocity, and Max Particles, which sets the maximum number of particles that can be alive at a given time. Lastly, we discussed Auto Random Seed, which generates a random seed for randomized particle behaviour.
By understanding and harnessing these basic settings, you can create captivating and visually stunning particle effects in your Unity games. Remember to experiment, fine-tune, and explore additional resources to expand your knowledge and creativity in working with Unity’s particle system.