Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 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
1
Question by kfboelter · Feb 09, 2011 at 03:46 AM · particleemitterparticleemitter

Particle emitter to emit "one-shot" on specific occasions

Hi. Question is simple... I have a cannon... when it goes boom, particles are emmited once... once it goes boom again, particles are emmited once... so on... Problem is, when it goes boom for the first time, i turn the emitter on, and even thou I have "one shot" selected, it keeps emmiting particles.. Is there a "correct" way to solve it? I`ve read stuff about creating co-routines and stuff... no other way? thks.

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

5 Replies

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

Answer by Eric5h5 · Feb 09, 2011 at 04:22 AM

"One-shot" doesn't mean the particles are emitted only one time, it means the particles are emitted all at once instead of over time. When all the particles run out of energy, they are emitted again, and will continue as long as the particle system is active and emit is set to true. What you're probably looking for is particleEmitter.Emit() (particleEmitter.emit should be 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 J3-Gaming · Mar 15, 2012 at 08:23 PM 0
Share

This is the perfect, and simple solution to one shot/one play particles.

avatar image Josh707 · Dec 30, 2012 at 09:01 PM 0
Share

Thanks for this! manually emitting a single particle was extremely useful for my project.

avatar image
0

Answer by lampshade · Feb 09, 2011 at 04:15 AM

Are there any scripts attached to this cannon you speak of?

public class Cannon : MonoBehaviour {

 public static bool turnOnEmitter = false;

 private void Update() { BoomScript(); }

 private void BoomScript() {
     ParticleEmitter pEmitter = GetComponent<ParticleEmitter>( );
     if (turnOnEmitter) {pEmitter.emit = true;}
     else 
         pEmitter.emit = 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 lampshade · Feb 09, 2011 at 04:20 AM 0
Share

$$anonymous$$ake sure AutoDestruct is off as well as One Shot, and toggle turnOnEmitter as needed in the inspector (For Testing) and then you could reference turnOnEmitter statically in another script.

avatar image Eric5h5 · Feb 09, 2011 at 04:23 AM 1
Share

This is pretty cumbersome; you can just use Emit() ins$$anonymous$$d.

avatar image
0

Answer by chozabu · Oct 21, 2011 at 03:14 AM

My solution to this problem was to create a prefab of a particle system; tick one-shot in the emitter and autodestruct on the animator. I then create an instance of that prefab when I want the smoke. Before this I was trying to do a method like the other answers here - but was landlocked by yield not working! It would just never return... (in boo, not tried other langs recently)

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 efge · Dec 24, 2012 at 02:36 PM

My solution:

chozabu's solution: "Create a prefab of a particle system; tick one-shot in the emitter and autodestruct on the animator. I then create an instance of that prefab when I want the smoke."

plus

Set Min Energy in the emitter to Zero.

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 shadowpuppet · Dec 19, 2016 at 01:28 AM

I used one of the supplied emitters prefabs. "sparks". I edited it to look like blood splatter then had the same problem discussed here. I opened the animation window and did 2 animations . the first the emitter is on and goes off after 1.5 seconds. The second animation is just dead 10 frames with the emitter off. In the animator window I have NewState as the default that transitions to my first animation on exit time ( which is immediate) and that - on exit time transitions to my second dead animation and there it just loops invisibly. So each time I shoot flesh and the blood splatter instantiates it plays those the first animation transitioning to the second animation where it remains off until the prefab times out

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Particle emitter works intermittently 0 Answers

Particle Emitter Toggle ON/OFF 1 Answer

Can you make a particle emitter that emits inwards? 4 Answers

Particle emitter object destroys itself 2 Answers

How can I solve my Mesh Particle Emitter problem? 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