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.

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.

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