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
1
Question by RGravity · May 09, 2012 at 09:25 AM · particlesparticle systemshurikenemission

Particle system does not re-emit until Start Lifetime elapsed

Hi,

I am using the particle system to create a gun emission effect that should occur as soon as the player presses fire. In the Update function the particle system is started when the player presses fire and stopped/cleared when they aren't pressing it - even if I place the stop/clear code prior to emitting, the system refuses to emit particles until the Start Lifetime timer has elapsed. Obviously this is not the desired behaviour as the emission is then intermittent and not immediate.

I have tried setting max particles to a high value and emission rate to a low value + several other tests but I am becoming convinced the particle system ignores any attempt to re-emit (even after clearing etc) until the Start Lifetime has elapsed since the last emission.

Any ideas what I can do to remedy this?

Thanks.

Comment
Add comment
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

4 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Piflik · May 09, 2012 at 10:01 AM

I would instantiate the particle system on ButtonDown and destroy it on ButtonUp, instead of controlling the emission rate.

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 RGravity · May 09, 2012 at 01:49 PM

Would this not cause undue garbage collection? I've mostly written mobile games over the last few years and creating/destroying objects at runtime is something I've learned to avoid like the plague.

Also I'm not attempting to dynamically control the emission rate as such, simply stopping and clearing/restarting the system, which intuitively I would have thought would do the job.

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 RGravity · May 09, 2012 at 02:02 PM

Ok this text may appear several times as it's the 3rd time I've posted a reply in the hope it will appear sometime!

Anyway, won't your suggestion cause unnecessary garbage collection? I've mostly worked with mobile platforms and I know to avoid creating/destroying objects at runtime like the plague.

Also I'm not trying to dynamically control emission but simply stopping, clearing/restarting the emitter which, intuitively, I would expect to just work.

Thanks.

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 Lo0NuhtiK · May 09, 2012 at 03:01 PM 0
Share

"Ok this text may appear several times as it's the 3rd time I've posted a reply in the hope it will appear sometime!"

Until your karma level reaches 15+ any answers/questions you post have to go through moderation, and re-posting them doesn't speed up the process (it simply results in duplicate posts being displayed after they've cleared moderation).
For adding comments, rather than posting comments as answers, theres an "add new comment" box at the bottom-right of answer/question posts (which get displayed immediately).
avatar image
0

Answer by RGravity · May 09, 2012 at 02:57 PM

I've managed to solve this )) it was my faulty understanding (I'm new to unity). I unchecked Looping, changed duration to 1.00 and reduce the Start Lifetime, then used particlesystem.Emit(1) in Update to emit a particle per frame while the fire button is held. Works nicely but I suspect the 1 may need to be made framerate-independent somehow.

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 slippdouglas · Mar 31, 2015 at 05:53 AM 0
Share

Somehow? Create a rolling count ivar.

 float _emitRollingCount = 0.0f;
 public float emitRate = 1.0f;
 
 void Update()
 {
     _emitRollingCount += this.emitRate * Time.deltaTime;
     if (_emitRollingCount >= 1.0f) {
         int emitNowCount = (int)$$anonymous$$athf.Floor(_emitRollingCount);
         _emitRollingCount -= emitNowCount;
         this.particleSystem.Emit(emitNowCount);
     }
 }

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to pause emitter in new Particle System? 2 Answers

Particle System(Shuriken) optimization problem 1 Answer

Shuriken particles - strange load CPU with ParticleSystem.Update 4 Answers

Multiple trails behind one particle? 1 Answer

Separate particle systems rendered together with a single sorting mode? 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