Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Rick74 · Aug 05, 2013 at 03:32 PM · javascriptdestroyparticlesystem

auto destruct a particle system.

I've been using this code I found from other answers of the same question, and it's generally worked out rather well.

 function Update ()
 {
      if ( particleSystem != null && particleSystem.particleCount == 0 )
     {
         Destroy ( gameObject );
     }
 }

I just attach that to the particle system in question and usually have had no issues. But I've tried to attach it to an explosion I've made, and for some reason the explosion now doesn't show up at all, it just instantly get's destroyed!

Anyone have any thoughts?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image maxG · Aug 05, 2013 at 05:38 PM 0
Share

are you using shuriken or the old system?

avatar image Rick74 · Aug 05, 2013 at 07:15 PM 0
Share

I am using the new system without the "auto destruct" toggle, I didn't know it had a name though.

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Apinaheebo · Aug 05, 2013 at 07:41 PM

Try this:

 private var ps : ParticleSystem;
      
     ////////////////////////////////////////////////////////////////
      
     function Start () {
              ps = GetComponent(ParticleSystem);
     }
      
     function Update () {
         if(ps)
         {
            if(!ps.IsAlive())
            {
              Destroy(gameObject);
            }
         }
     }
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rick74 · Aug 08, 2013 at 08:42 PM 0
Share

Thanks for the script, I tested it out and it seems to have solved the issue.

avatar image
0

Answer by wijesijp · Aug 05, 2013 at 03:48 PM

maybe at the beginning partial count is 0, it take some time to start ...

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rick74 · Aug 05, 2013 at 07:26 PM 0
Share

There is no Prewarm or start delay.

Duration : 0.10, Looping off, Prewarm off, Start Delay : 0, Start LifeTime : 1, Start Speed : ( random 2 - 3 ), start size : ( random 1 - 2 ), start rotation : 0, start color : ( white ), gravity multiplier : 0, Inherit Velocity : 0, Simulation Space : Local, Play on Awake : on, $$anonymous$$ax Particles : 300. Emission : Rate : 300, bursts : Time : 0.10 Particles : 150, Shape : Sphere : Radius : .3111069, Color over Lifetime : ( alpha gradiant from a white - yellow - red - black ), Size over Lifetime : ( linear from 1.0 - .55 ), Renderer : Billboard : Normal Direction : 1 $$anonymous$$aterial : Default-Particle : Sort $$anonymous$$ode : None, Sorting Fudge : 0, Cast Shadows : on, Recieve Shadows : on, $$anonymous$$ax Particle Size : .5

avatar image
0

Answer by davidsubba · Dec 09, 2013 at 09:43 PM

I have a particle prefab and attached this script, it works.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Particle system play too late (c#) 1 Answer

How to destory any object that collides with a particle in a particle system?? 1 Answer

error in destroying bullet prefab 1 Answer

OnTriggerEnter to Destroy Objects not working Correctly 1 Answer

When An Object Doesnt Exist, Help Making a Variable In Another Script Change 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges