@@ -17,11 +17,16 @@ public class FlexRenderer : MonoBehaviour
1717
1818 public bool BurstRender = false ;
1919
20+ public Vector3 MinRenderPos = new Vector3 ( - 1000 , - 1000 , - 1000 ) ;
21+ public Vector3 MaxRenderPos = new Vector3 ( 1000 , 1000 , 1000 ) ;
22+
2023 bool FirstTime = true ;
2124
2225 UpdateParticlesJob job = new UpdateParticlesJob ( ) ;
2326 //ParticleSystem.Particle[] mainThreadParticles;
2427
28+ ParticleSystem . Particle [ ] mainThreadParticles ;
29+
2530 // Start is called before the first frame update
2631 void Start ( )
2732 {
@@ -40,6 +45,10 @@ void Start()
4045
4146 //var Hope = GetComponent<ParticleSystemRenderer>();
4247 //Hope.allowOcclusionWhenDynamic = false;
48+
49+ mainThreadParticles = new ParticleSystem . Particle [ Container . MaxParticles ] ;
50+ mainThreadParticles [ 0 ] . position = MinRenderPos ;
51+ mainThreadParticles [ 1 ] . position = MaxRenderPos ;
4352 }
4453
4554 // Update is called once per frame
@@ -75,11 +84,11 @@ void OnParticleUpdateJobScheduled()
7584 {
7685 if ( Container . SlotsUsed > 1 )
7786 {
78- var mainThreadParticles = new ParticleSystem . Particle [ Container . SlotsUsed ] ;
79- mainThreadParticles [ 0 ] . position = new Vector3 ( - 1000 , - 1000 , - 1000 ) ;
80- mainThreadParticles [ 1 ] . position = new Vector3 ( 1000 , 1000 , 1000 ) ;
87+ // mainThreadParticles = new ParticleSystem.Particle[Container.SlotsUsed];
88+ // mainThreadParticles[0].position = MinRenderPos ;
89+ // mainThreadParticles[1].position = MaxRenderPos ;
8190
82- FluidRenderer . SetParticles ( mainThreadParticles ) ;
91+ FluidRenderer . SetParticles ( mainThreadParticles , Container . SlotsUsed ) ;
8392 }
8493
8594 if ( FluidRenderer . particleCount > 1 )
0 commit comments