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?
var ps = GetComponent<ParticleSystem>();
var emission = ps.emission;
emission.rateOverTime = 10f;
Debug.Log(emission.rateOverTime.constant);Remember that rateOverTime is a MinMaxCurve and .constant returns the float value.
The emission.rateOverTime property is a MinMaxCurve. Setting it to 10f sets a constant rate of 10 particles per second. Accessing .constant returns the float 10.
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?
var ps = GetComponent<ParticleSystem>(); var shape = ps.shape; shape.shapeType = ParticleSystemShapeType.Cone; shape.angle = 25f; shape.radius = 0.5f; Debug.Log(shape.shapeType);
Look at the shapeType property assigned.
The shapeType property is set to ParticleSystemShapeType.Cone, so the output is 'Cone'.
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?
var ps = GetComponent<ParticleSystem>(); var emission = ps.emission; emission.rateOverTime = new ParticleSystem.MinMaxCurve(5f, 10f); Debug.Log(emission.rateOverTime.constant);
Check what happens when MinMaxCurve uses two constants.
When MinMaxCurve is set with two constants, its mode is TwoConstants. Accessing .constant throws InvalidOperationException because .constant is undefined in this mode.
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?
Check the 'Emit from Shell' option in the shape module.
Enabling 'Emit from Shell' on a Sphere shape makes particles emit only from the surface (shell) of the sphere.
In Unity, if you change emission.rateOverTimeMultiplier during gameplay, what happens to the particle system's emission?
Think about how multipliers affect emission rate dynamically.
Changing emission.rateOverTimeMultiplier at runtime immediately affects the emission rate by multiplying the base rate, allowing dynamic control.