How to create ParticleEmitter in code

When I try to add a particle emitter in code like this:

ParticleEmitter emitter = gameObject.AddComponent<ParticleEmitter>();

I get this error:

Cannot add component of type 'ParticleEmitter' because it is abstract. Add component of type that is derived from 'ParticleEmitter' instead.

I looked through the documentation and I couldn't find any classes which derive from ParticleEmitter so I tried to make my own like this:

public class RocketExhaustEmitter : ParticleEmitter 

Which gives me the following error:

error CS0509: `RocketExhaustEmitter': cannot derive from sealed type `UnityEngine.ParticleEmitter'

Is there a way to create a ParticleEmitter from scratch in code or do I have to use a Prefab?

ParticleEmitter emitter = (ParticleEmitter)gameObject.AddComponent("EllipsoidParticleEmitter");


ParticleEmitter emitter = (ParticleEmitter)gameObject.AddComponent("MeshParticleEmitter");


Since you can only have a variable of their parent type, ParticleEmitter, you can only access members they inherit from it, but nothing specific to the particular children types e.g. size of the spheroid or wether mesh emitter is systematic. But this is still useful if you want to create your own particle system - you would then have an instance of the ParticleEmitter with `emit` property set to `false` and emit and/or animate particles yourself accessing `particles` array property.