- Home /
Question by
Le-Capitaine · Sep 11, 2014 at 02:07 PM ·
c#shurikenemit
Can new Shuriken particles be emitted at runtime?
I have this code:
public Bullet Fire (Vector3 pos, Vector3 vel, bool localised = false) {
Bullet bullet = new Bullet();
bullet.bullet = new ParticleSystem.Particle();
bullet.bullet.color = particleSystem.startColor;
bullet.bullet.position = pos;
bullet.bullet.velocity = vel.normalized * speed;
bullet.bullet.size = particleSystem.startSize;
bullet.bullet.lifetime = (range / speed) / 60;
bullet.localised = localised;
particleSystem.Emit (bullet.bullet);
bullets.Add (bullet);
return bullet;
}
A Debug.DrawLine statement reveals that the particle is indeed emitted at the correct position (though not the correct velocity, but hey, one thing at a time) and a Debug.Log one reveals that the colour is correctly set as well.
Despite all of that, the particle won't display. Is something flying over my head again?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613162814im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Freeze particles emitted with Shuriken 1 Answer
Making a Shuriken Particle System Turn on and off. 1 Answer
Emit from Edge in Script 1 Answer