Question by 
               DavidNLN · Nov 17, 2018 at 01:35 AM · 
                particlesparticlesystemparticle systemparticle  
              
 
              Moving particle system via script causes choppy movement in build but works fine in pay mode
Hello, I'm drawing a bunch of particles on the screen with a small for loop like so:
             for( int i=0; i<MaxStars; i++ )
             {
                 float randSize = Random.Range( StarSizeRange, StarSizeRange + 1f );                        
                 Stars[i].position = GetRandomInRectangle( FieldWidth, FieldHeight ) + transform.position;
                 Stars[i].startSize = StarSize * randSize;
                 Stars[i].startColor = color;
             }
             Particles.SetParticles( Stars, Stars.Length );  
 
               Then on the update method I'm trying to move it according to the camera, this works perfectly in play mode, but when I build it and run it the particles movement is very choppy but the rest of the game (character, npcs, monsters) moves fine.
         private void Update()
         {
             Vector2 velocity = camera.velocity * -1 * parallexModifier * Time.deltaTime;
             var pos = Particles.transform.position;
             
             Particles.transform.position = new Vector2(pos.x + velocity.x, pos.y + velocity.y);
         }
 
              
               Comment
              
 
               
              Answer by karl_jones · Nov 17, 2018 at 09:52 AM
Where do you do the drawing? What does the full code look like?
What do you mean where ? right after the for loop Particles.SetParticles( Stars, Stars.Length );
This line draws them
SetParticles does not draw anything, it just changes the internal data. What does your full code look like?
Your answer