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 Rabwin · Apr 11, 2011 at 03:04 PM · particlesparticle

Change Particle Emitter fire rate?

I swear there was a setting in the emitter to change the rate/speed of the particle going off or something like that.

Thats basically what I want to do. Also I wanted to randomize the rate/speed using a min and max value.
I could achieve both easily with scripting but was wondering if there was a proper way to do it?

The only script ideas I've got is to either:

  • enable/disable the emitter on a timer.
  • instantiate a particle emitter and then have it destroy itself

Is either the correct way to script it? (Obviously we would want the most efficient way)
Is there a more convenient way to do this?

Edit: I'm using, and need to use one-shot.

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
3
Best Answer

Answer by Rabwin · Apr 12, 2011 at 12:27 AM

I ended up answering my own question after some searching through the scripting reference on the emitter. Thanks for trying to help through. Is it just me or is there a lot of people who are suddenly able to answer their own questions almost right after asking them.

Well, heres a basic script I came up with to achieve the effect I wanted.

using UnityEngine; using System.Collections;

public class ParticleEmitter_FireRate : MonoBehaviour { public float fireRate = 1.0f; // The rate at which particles should be Emitted. public bool randomizeFireRate = true; public float randomNum = 1.0f; private float lastTime; private float newRate; public int minParticles = 0, maxParticles = 5; void Awake() { if (particleEmitter.emit == true) { particleEmitter.emit = false; } lastTime = Time.time; newRate = fireRate; }

 void Update()
 {
     if (Time.time > lastTime + newRate)
     {
         particleEmitter.Emit (Random.Range(minParticles, maxParticles));
         lastTime = Time.time;
         if (randomizeFireRate == true)
         {
             newRate = Random.Range(fireRate - randomNum, fireRate + randomNum);
         }
     }
 }

}

Edit: Plus it's much much easier to use than playing around with the velocity/energy. Also as you can see, I use my own timers instead of the unity built ones. I just never liked them.

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
1

Answer by DaveA · Apr 11, 2011 at 03:35 PM

Look at Rnd Velocity (for direction/speed of movement), and Min and Max Emmission for rates

Comment
Add comment · Show 5 · 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 Rabwin · Apr 11, 2011 at 04:03 PM 0
Share

Are you sure that's what it is? The Rnd Velocity I'm looking at contains a vector3 which affects the DIRECTION of the particles, but not the rate at which particles are actually created. I should probably add, that I am using one-shot and need to use it.

avatar image DaveA · Apr 11, 2011 at 06:36 PM 0
Share

Sorry that would be $$anonymous$$in and $$anonymous$$ax Emmission

avatar image Rabwin · Apr 11, 2011 at 09:40 PM 0
Share

I'm confused, for me $$anonymous$$ and max emission just changes the amount of particles co$$anonymous$$g out, but it's still firing at the same speed.

avatar image Rabwin · Apr 11, 2011 at 09:45 PM 0
Share

Also, if you have a look at Energy, it does a similar thing where it makes the shot particles last longer, and end result is the next shot of particles are delayed until the current ones die.

I just don't want the particles to fly that far.

avatar image DaveA · Apr 11, 2011 at 11:31 PM 0
Share

If the emission numbers are set higher, it has to produce more particles. Energy does indeed play a part in that the longer particles last, the sooner the emission 'maxes out'. I suppose you could come up with a formula that converts Unity's numbers into 'particles per second'. Sounds like you want a high $$anonymous$$ emission and low energy. Velocity will deter$$anonymous$$e how far they fly in that short time.

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

Using Particles with Collision 2 Answers

particleSystem.Play(); wont start 1 Answer

Is there a way to draw particles on a raycast? 2 Answers

How to get newest Particle in a ParticleSystem 1 Answer

Rotation of the Particle System is ignored for velocity over lifetime when the simulation space is Custom. Is this a bug? 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