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 LifeSizeDeity · Feb 28, 2011 at 09:52 PM · particleemittersmoke

Particle system question

I'm having trouble getting the code snippet to work, any ideas? Basically this just creates a puff of smoke and when the number of particles is equal to or exceeds the min number of particles, it shuts the emitter down. At least it's supposed to. The makeSmoke function gets called from another script.

public GameObject [] smokeEmitter = new GameObject[10];

// Use this for initialization

void Start ()

{

for(int i = 0; i < 10; i++)

{

//turn off the smoke particle effect smokeEmitter[i] = GameObject.Find("Base/Missle" + (i+1) + "/Smoke");

smokeEmitter[i].particleEmitter.ClearParticles(); smokeEmitter[i].particleEmitter.emit = false; smokeEmitter[i].particleEmitter.enabled = false;

}

}

// Update is called once per frame

void Update () {

for(int i = 0; i < 10; i++) {

  if((smokeEmitter[i].particleEmitter.particleCount &gt;= 
      smokeEmitter[i].particleEmitter.minEmission) &amp;&amp; 
      smokeEmitter[i].particleEmitter.emit == true)
  {
    smokeEmitter[i].particleEmitter.ClearParticles();
    smokeEmitter[i].particleEmitter.emit = false;
    smokeEmitter[i].particleEmitter.enabled = false;

  }

}

public void makeSmoke(index i)

{

smokeEmitter[i].particleEmitter.enabled = true;

smokeEmitter[i].particleEmitter.emit = true;

}

Comment
Add comment · Show 3
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 Jessy · Feb 28, 2011 at 10:08 PM 0
Share

Please look at your posts after you post them and make sure they look readable.

avatar image Alec-Slayden · Feb 28, 2011 at 11:28 PM 0
Share

Would you $$anonymous$$d letting us know what the problem is? Is the script returning an error, or is the smoke not stopping?

avatar image LifeSizeDeity · Feb 28, 2011 at 11:39 PM 0
Share

Oh yeah, sorry about that. Currently I'm not getting any particles to spawn.

1 Reply

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

Answer by DaveA · Feb 28, 2011 at 11:29 PM

It's going to make min particles immediately, so your code will immediately shut it down, and won't Clear and enabled=false turn off rendering too?

Try taking out the ClearParticles and enabled=false, just set emit=false, and the minimum number of particles should remain (until they fade out naturally)

Comment
Add comment · Show 4 · 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 LifeSizeDeity · Feb 28, 2011 at 11:49 PM 0
Share

You were absolutely right about the ClearParticles(), good call. Unfortunately it's still not working with just setting the particleEmitter.emit to true and false. Any ideas?

avatar image LifeSizeDeity · Mar 01, 2011 at 12:02 AM 0
Share

Weird thing, I put tethered the emit = true of the first object to the space bar in the update right above the check and it works perfectly??????

avatar image LifeSizeDeity · Mar 01, 2011 at 12:05 AM 0
Share

I just figured it out. The object that I create is scaled up from zero when its created and since this is a mesh particle emitter, the particles emit from the size of the mesh which happens to be next to nothing. Thanks everybody for helping me walk through this.

avatar image DaveA · Mar 01, 2011 at 12:07 AM 0
Share

No problem, glad you found it

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

No one has followed this question yet.

Related Questions

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

Particle Emitter Toggle ON/OFF 1 Answer

ParticleSystem.Play() does not play particle. 10 Answers

particle emitter when moving 1 Answer

How to make particles not move with the emitter. 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