Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Harizio · Jun 30, 2016 at 02:32 PM · particlesparticle systemparticleparticle emitteremit

Particle system won't restart emitting before last particle has died

I'm trying to make a particle system emit whenever I hold a button down and stop emitting when I'm not pressing the button. The particles have a 1 second lifetime and they die on collision.

The problem is that if I let go of the button and press it again quickly, the particle system won't start emitting again before the previous particles have died either by running out of lifetime or by colliding with anything. I only have to wait for the previous particles to die after I have called either Stop() or Emit().

The same problem persisted whether I was using Emit() or Stop() and Play(). I also tried using Clear() before Play() but it didn't help.

Unity version 5.3.5f1

Comment
Add comment · Show 1
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 Harizio · Jul 01, 2016 at 05:36 PM 0
Share

I didn't really find a fix for the problem but I found a workaround that works for my use-case. Ins$$anonymous$$d of stopping and starting the particle system I changed the alpha value of the particle systems startColor between 0 and 255 to make any particles emitted when I'm not holding the button invisible.

3 Replies

· Add your reply
  • Sort: 
avatar image
7

Answer by Velorom · Sep 02, 2017 at 01:22 PM

Also you can enable/disable an emission module:

 ParticleSystem.EmissionModule em = particleSystem.emission;
 em.enabled = false;
Comment
Add comment · Show 2 · 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 Yany · Nov 19, 2017 at 02:08 AM 0
Share

This worked nicely. I don't understand why this bug is still in the particle system. Practically you cannot turn the particle system on/off in short periods that are under the length of the particles lifetime. However it's a good workaround I suppose it's not the best to keep a particle system playing (even with emitter off) from optimization aspect.

avatar image B4ttleCat · Nov 11, 2020 at 11:57 AM 2
Share

In 2020 this is still the cleanest answer I've found and did exactly as Play > Stop > Play should do but for some reason still won't.

avatar image
3

Answer by seandanger · Feb 12, 2021 at 10:20 PM

Forcing the particles to stop and clear fixed the problem for me. I feel like this should be standard behavior though. I wrote an extension method that I use in place of Play() for my particle systems, maybe someone else will find it useful:

 public static class UnityUtils
 {
     public static void PlayProperly(this ParticleSystem particles, bool withChildren = true)
     {
         if (particles.isPlaying)
             particles.Stop(withChildren, ParticleSystemStopBehavior.StopEmittingAndClear);
 
         particles.Play(withChildren);
     }
 }
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
avatar image
0

Answer by farid_fahara · Nov 11, 2020 at 02:08 PM

just uncheck loop in the particle system and create a new clone of the particle system when you click the button

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

9 People are following this question.

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

Related Questions

Particles and scrolling objects 0 Answers

Can I make uniform emission for Particle System? 2 Answers

Emit particles from image/sprite 1 Answer

Blast Particle Not Spreading to Fullscreen 0 Answers

Particle Playback Error in 5.4 0 Answers


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