How to modify the param value of "shape" section in Particle System using C# code?

If is possible to modify the box size of a particle system using C# code?
I can’t find the method in API Document.
8783-ps.jpg

Is not true. You can modify all variables.

For example, i change my angle shape:

SerializedObject so = new SerializedObject(GetComponent<ParticleSystem>());
so.FindProperty("ShapeModule.angle").floatValue = 25f;
so.ApplyModifiedProperties();

You can see all particleSystem propriety with:

SerializedProperty it = so.GetIterator();
while (it.Next(true))
 Debug.Log (it.propertyPath);

(sorry for my bad english, i’m italian).

Unfortunately, it is not accessible via scripting yet.

I don’t know if this is a new thing, but changing the transforms scale gave the wanted result for me.

Hey,
I know this post is old but I try to change the shape and it does not work.

    BoxCollider Col = null;
    ParticleSystem PS = null;

    private void Awake()
    {
        Col = transform.parent.GetSafeComponent<BoxCollider>();
        PS = this.GetSafeComponent<ParticleSystem>();


        UnityEditor.SerializedObject so = new UnityEditor.SerializedObject(PS);
        //UnityEditor.SerializedProperty it = so.GetIterator();
        //while (it.Next(true))
        //    Debug.Log(it.propertyPath);

        so.FindProperty("ShapeModule.boxX").floatValue = Col.size.x;
        so.FindProperty("ShapeModule.boxY").floatValue = Col.size.y;
        so.FindProperty("ShapeModule.boxZ").floatValue = Col.size.z;
    }

Any Ideas? @WILEz1975

Cheers :slight_smile:

Edit: Solution

so.ApplyModifiedProperties();

In case somebody stumble upon this:

Vector3 box = new Vector3(sizeX,sizeY,sizeZ);
ParticleSystem.ShapeModule shape = particles.shape;
shape.box = box;