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 xDeltax · Oct 17, 2011 at 01:49 AM · arrayparticlesemit

Make an Array of Particles emit at the same time

Here's the script:

 var BParticles: ParticleEmitter[];

 function Start () {
     for (var particles in BParticles){
         particles.emit = true;
         yield WaitForSeconds (Random.Range(5.0, 10.0));
         particles.emit = false;
     }
 }

The problem is that the particles don't emit at the same time... Any help would be appreciated

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 syclamoth · Oct 17, 2011 at 01:53 AM 1
Share

(Fixed your formatting because I hate bad formatting)

avatar image xDeltax · Oct 17, 2011 at 02:15 AM 0
Share

Thank you

1 Reply

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

Answer by syclamoth · Oct 17, 2011 at 01:56 AM

The problem is that you are using yield WaitForSeconds(whatev) in the middle of your for loop! What is happening here, is it is cycling through your particle systems, turning each one on one at a time (which is actually kind of more sophisticated behaviour than what you were aiming for here...)

You should rearrange it so that the WaitForSeconds bit only happens once-

 function Start () {
     for (var particles in BParticles){
         particles.emit = true;
     }
     yield WaitForSeconds (Random.Range(5.0, 10.0));
     for (var particles in BParticles){
         particles.emit = false;
     }
 }

This way, it'll turn everything on, wait for a few seconds, then turn everything back off again.

If that's not what you want, and instead you want all the particle systems to have a different wait time, you could use a coroutine!

 function Start () {
     for(var particles in BParticles)
     {
         StartCoroutine(OnOffParticles(particles));
     }
 }


 function OnOffParticles(var emitter : ParticleEmitter)
 {
     emitter.emit = true;
     yield WaitForSeconds (Random.Range(5, 10));
     emitter.emit = false;
 }

That will set a different, random timer on each particle system.

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 xDeltax · Oct 17, 2011 at 02:15 AM 0
Share

Problem solved. Thank you so much

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Turn all objects in the array to make same thing 0 Answers

Is there a way to emit particles at equal interval angles? 1 Answer

particle system stops normal emissions after .emit() is called 0 Answers

How to force a particle system emit from every vertex a mesh have? 3 Answers

ParticleSystem is not emitting particles. 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