I have a prefab that was already tuned to have the needed shuriken particle, It uses bursts. But depending on the situation I need to change the amount of particles per burst. Is that possible to do from the code? (Without firing bursts themselves from the code)
Grab the read-only reference so you can set its values:
ParticleSystem ps = GetComponent <ParticleSystem> ();
ParticleSystem.EmissionModule em = ps.emission;
Set its type to Time:
em.type = ParticleSystemEmissionType.Time;
Call the SetBursts () method:
em.SetBursts (
new ParticleSystem.Burst [] {
new ParticleSystem.Burst (2.0f, 100),
new ParticleSystem.Burst (4.0f, 100)
});
Note: If the prefab specifies a min & max particle amount instead of a constant, you can pass in a third argument like below (Here, 100 is the min, 200 is the max):
new ParticleSystem.Burst (2.0f, 100, 200)
Full Code snippet here: ParticleSystem.emission