- Home /
Vanish the Shuriken particle system clone
Hi.I made a particle system using Shuriken and a script that emitting the particle when I press a button.
It works like I wanted but a clone of the particle system still remains in the hierarchy panel.
I unchecked "Looping" in inspector.
How do I erase clone when the particle system finish emitting? Thanks in advance.
Answer by eagletree · May 07, 2012 at 03:30 PM
If you use Instantiate to create the ParticleSystem when the button is pressed, it will have created a clone in your hierarchy window. You will need to use Destroy to eliminate the clone that was instantiated. One way to do this, would be to attach a script to the gameObject of the ParticleSystem, that does a StartCoroutine in which you will WaitForSeconds (long enough for the Particle to complete), and then Destroy(transform.gameObject);. The script would look something like:
void Start() {StartCoroutine(DestroyClone());}
IEnumerator DestroyClone() {yield return new WaitForSeconds(5);Destroy(transform.gameObject);}
This assumes 5 seconds is sufficient for your particlesystem to complete. The script would be attached to your ParticleSystem's gameobject.
Your answer
![](https://koobas.hobune.stream/wayback/20220613065823im_/https://answers.unity.com/themes/thub/images/avi.jpg)