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
2
Question by Setsuki · Nov 27, 2012 at 05:20 PM · particlesshurikenemission

Shuriken particle system : disable and re-enable emitter

Hello everyone,

I am currently stuck using the particle system on Unity 3.5

My character is able to switch between 2 weapons, by throwing them out of the screen. These weapons have a particlesystem attached to them.

What I want is to stop emitting when the weapon isn't used. It seems easy, but using

 Stop();

or

 enableEmission=false;

are making the particles already emitted disappear. I could work with that, but it's not as pretty as it could be.


Worse, when I get the disabled weapon back, using

 Play();

or

 enableEmission=true;

make those disappeared particles reappear at the exact point they were when I disabled the emission.


All I can do is use

 Clear();

To remove those invisible, unsimulated particles. But they still disappear strangely.

I would like to know if there is a way to :

  • Disable emission without deleting the particles.

  • Reenable emission from the beginning (Simulate(0f) doesn't work).

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

2 Replies

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

Answer by AeonIxion · Nov 28, 2012 at 09:29 AM

Perhaps you can use particleSystem.Emit(int count) in the update function?

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 Setsuki · Nov 28, 2012 at 09:31 AM 0
Share

I COULD do the emission myself, and so might be able to change this annoying Stop() behaviour ! I'll mark as correct if this works, thanks.

avatar image Setsuki · Nov 28, 2012 at 09:38 AM 0
Share

Thanks a lot. Now, I just have to find a way to simulate the "distance" emission, and disable my weapon's renderer. That's too bad something as simple as this needs manual tweaking, even this $$anonymous$$imal.

avatar image
1

Answer by Tea_Doogun · Nov 27, 2012 at 05:48 PM

Shuriken is a little different to the old particle system...this is how i did it:

Start by making a variable:

 var beam : ParticleSystem;
 
 function Start(){
 
 //this will make the particle system usable in function Update
 beam = GetComponent(ParticleSystem);
 
 //this clears the particle system when you start the game...use it if you like
 beam.Stop();
 beam.Clear();
 
 }
 
 function Update(){
 
 //This will start the particles playing when you press the left mouse button
 if (Input.GetMouseButton(0)){
     beam.Play();
         }
 
 //This will stop the particle system when you let go of the button
 if (Input.GetMouseButtonUp(0)){
     beam.Stop();
     beam.Clear();
     }
 
 }

Attach the script to the particle system, and drag the same particle system into the 'beam' variable.

Hopefully this gives you an idea of how the particle system can be stopped and started

If you have 2 particle systems, just use 2 variables (beam & beam2 for instance)

Not used to answering questions, let me know if anything is unclear :)

Comment
Add comment · Show 6 · 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 Tea_Doogun · Nov 27, 2012 at 05:55 PM 0
Share

edited, i didn't use an empty game object, i just put the script onto the particle system itself.

avatar image Setsuki · Nov 27, 2012 at 07:35 PM 0
Share

Hello. First, thanks for your answer. second, This is also the solution I have so far. the problem being that "stop" also deletes the particules that have already been emitted.

avatar image Tea_Doogun · Nov 27, 2012 at 08:14 PM 0
Share

Oh, whoops. Like i say, not used to answering questions :p

The only other thing that comes to $$anonymous$$d is increasing the 'Start Lifetime' in the particle system. Other than that, i'm stuck.

Sorry man.

avatar image Setsuki Tea_Doogun · Nov 28, 2012 at 08:36 AM 0
Share

No problem, at least you tried. I'll check that, thanks.

avatar image sandybites · May 27, 2014 at 10:48 PM 0
Share

Hey guys, if I may ask, how do you declare "beam" in c#?

avatar image Setsuki · Jun 01, 2014 at 10:04 AM 0
Share
 ParticleSystem beam = GetComponent(ParticleSystem);

so beam is simply the shuriken particle system you added to your game object. Same game object that contains this script.

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

13 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

Related Questions

Shuriken Subemitter Emission broken in Playmode. 2 Answers

Particle system does not re-emit until Start Lifetime elapsed 4 Answers

Setting the position of particles in a (shuriken) ParticleSystem 3 Answers

Scale Shuriken Particle System with Parent Transform 5 Answers

How to pause emitter in new Particle System? 2 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