- Home /
How to burst a particle system twice?
Hello. I have a bit of problem getting a simple burst particle system to work. To reproduce the issue, create a new Particle System, set Duration and Start Lifetime to 1, then under Emission set Rate to 0 and add a Burst with the default settings. Disable Looping and Play On Awake.
Then, I'd like to drive the burst through code. A simple demonstration could be per mouse click.
using UnityEngine;
using System.Collections;
public class PlayParticles : MonoBehaviour
{
void Update ()
{
if (Input.GetMouseButtonDown (0)) {
var ps = GetComponent<ParticleSystem> ();
ps.Stop ();
ps.Clear ();
ps.Play ();
}
}
}
I would expect that on each mouse click, a burst is played. This works until the particles disappear. After particles have disappeared, calls to Play does nothing. However, if I change simulation space to World, then Play works as intended. The problem is that I require local space simulation.
How can I make the particle system play more than once, after the initial particles have disappeared?
I'm using Unity 5.3.2f1
It appears 5.3.3 has a fix which I'll try later.
"Particles: Fixed issue where particle system is stopped and cleared and after that it won't play when simulation space is set to local. (756971)"
Answer by Statement · Mar 21, 2016 at 12:36 PM
Works with 5.3.4
@statement Hey man, during my trials and tribulations developing things...I've seen you answer so many questions and help so many people. You're a bad mother fucker. I saw you hadn't been active since last year so I hope whatever you're doing you're happy and that sometime you see my message. Thanks for being awesome.
Your answer
