- Home /
Can't start particle system by code!
Hello everyone, I am new to unity and specially to particles in unity. So my plan is to have a dynamic background of stars using particles. Here's my code: public class particlesBackground : MonoBehaviour {
public int particleCount;
public double initTime = 10;
public ParticleSystem PS;
void Start () {
PS.Simulate(initTime);
}
void Update () {
PS.Emit(particleCount);
}
}
So as I run the game, The particles start as I want (10 sec), but they don't move, I want to start the emission from the current simulated time which is 10sec. Any help?
Comment
Sorry, the initTime has to be float ins$$anonymous$$d of double!
Your answer
![](https://koobas.hobune.stream/wayback/20220613071933im_/https://answers.unity.com/themes/thub/images/avi.jpg)