ParticleSystem -> Prewarm AFTER setting up particlesystem using scripting?

Hey

I have a specific particle system that im creating variations of.

Each variation is basically the same ParticleSystem with different color and emitting direction.

The setup is such, that the ParticleSystem is Prefab, and color/emitting direction/… is changed using scripting.

Now, i have a requirement → the particle system when instantiated should be “Prewarm”-ed. Prewarm means the system on start will be already in a state as if it has emitted one cycle (up and running, not from beginning).

So im trying to create variations that are Prewarm-ed.

But there is no such thing accessible through scripting like ParticleSystem.Prewarm, so i can not (after applying my changes to prefab particle system) set this variation to “Prewarm” state using scripting.
Can i? Anyone has suggestion?

The only workaround i found is to create as many prefabs as i have variations, so i can set “Prewarm” via inspector… but this obviously is not desirable.

Okay, my bad, this one is actually pretty easy.

After the PS setup (new color, emit direction, what have you), you can “restart as if prewarmed” using some combination of existing supported methods, example:

// get ref to your particle system
ParticleSystem ps = GetComponent<ParticleSystem>();

// ps now updated with different color, emitting direction, etc
// clear old particle system (old color, emitting direction etc)
ps.Clear();

// set the particle system to "prewam state" and pause
// one cycle is same as ps.duration
ps.Simulate(ps.duration);