x


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.

more ▼

asked Apr 03 '12 at 01:35 AM

kamexo3196 gravatar image

kamexo3196
1 2 3 3

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered May 07 '12 at 03:30 PM

eagletree gravatar image

eagletree
0 1 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x636
x161

asked: Apr 03 '12 at 01:35 AM

Seen: 744 times

Last Updated: May 07 '12 at 03:30 PM