How do change particle system mesh via script?

How do change particle system mesh via script?
55657-1.png

ParticleSystem.mesh = particlemeshes[1];
I tried this code but it didnt work:

Unity 2018.1

GetComponent<ParticleSystem>().GetComponent<ParticleSystemRenderer>().mesh = mymesh;

More info: Unity - Scripting API: ParticleSystemRenderer

It’s not possible. There is a hack to do it inside the Editor environment, but it is not possible in a standalone build. I regard it as a serious limitation of Unity’s ParticleSystem, but we have to live with it (for now).

The best thing you can do is resize the Transform of the gameobject the PS is on to approach the area you want to cover.