- Home /
How to set ParticleSystem.startRotation3D by code?
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.
Answer by Rodolfo-Rubens · May 06, 2017 at 02:18 AM
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;
Your answer
![](https://koobas.hobune.stream/wayback/20220612102555im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Particle Collision Mesh Occlusion 1 Answer
What would be the "next-best-thing" to a ParticleSystem? 1 Answer
Particle System GPU Instancing is not working. 0 Answers
Passing particle system in script, getting null reference exception error. 1 Answer
How can I change the gravity modifier of a particle system through script? 1 Answer