Set particle position in Start()

Hello, i wan’t set my particle position, i can only do that i start but it doesn’t work. Why ?

 void FillParticlesArray(Vector3 position)
    {
        particles = new ParticleSystem.Particle[particlesSys.main.maxParticles];


        int nbParticles = particlesSys.GetParticles(particles);


        for (int i = 0; i < nbParticles; i++)
        {
            particles[i].position = position;
        }

        particlesSys.SetParticles(particles, nbParticles);
    }

EDIT :
Hi, after some tests i have found how the bug work.

When i activate play mode, the particules are in good position during 2 seconds and after it going to random position.

How can i disable it ?

Used Debug.Log and breakpoints to find issues.

Hi, after some tests i have found how the bug work.

When i activate play mode, the particules are in good position during 2 seconds and after it going to random position.

How can i disable it ?

Are you sure, you not looking at emitted particles, rather than source?

Btw, is not bug, but debug :wink:

probably the particles die (due to Start Lifetime value) and then respawn elsewhere.
so try lifetime as some maximum value, and disable emission too.

2 Likes

Thank you !!! Now it during more time but i’m going to set more time with script. It isn’t possible to set the value “infinity” or something like that?

Well, actually You could type “infinity” in the lifetime field and it will work (it worked once), so try doing that.

No it doesn’t work for me.