I’ve got a projectile pooling script that puts unused objects far out of the rest of the scene. The projectiles I use have Shuriken particle effects. I am trying to stop and clear the particles after the projectile is released and before it is reused.
BulletBehaviour bulletBehaviour = projectile.GetComponent<BulletBehaviour>();
//Turn off particles
bulletBehaviour.bullet.particleSystem.Stop();
bulletBehaviour.bullet.particleSystem.Clear(true);
//Move projectile to where it is needed
projectile.rigidbody.velocity = Vector3.zero;
projectile.transform.position = spawnPosition;
projectile.transform.rotation = Quaternion.identity;
//Turn on particles
bulletBehaviour.bullet.particleSystem.Play();
I am seeing a trail as the bullet is moved from its offscreen position to spawnPosition. Whatever I try, I can’t get the particles to disappear. I’ve also tried
bulletBehaviour.bullet.particleSystem.enableEmission = false;
without success.
BulletBehaviour has a reference to bullet, which is the model that actually has the particle system.