I try two ways to set ParticleSystem.startRotation3D in code
-
[ParticleSystem].startRotation3D=new Vector3(45,0,0);
-
[PartcileSystem.Particle].rotation3D=new Vector3(45,0,0);
Unless I tick the checkbox “3D Start Rotation” in inspector manually , they didn’t work!
But how can i set “3D Start Rotation” to true by code in Unity5.4.0?I can’t seem to find anything in the API for this.
To modify modules from a particle now you need to create a reference of the module:
var main = particleSystem.main;
main.startRotation3D = true;
The values of the start rotation are separated like startRotationX, startRotationY, startRotationZ, you can modify them the same way above.
var main = particleSystem.main;
main.startRotationX = 45;
main.startRotationY = 0;
main.startRotationZ = 0;