Unity Shuriken Particle Randomness

I love the Shuriken particle system but I’m having an issue with the randomisation, specifically that there doesn’t seem to be any despite the use of “Random between two constants” across multiple variables.

For example, my enemy on-death particle effect emits the same few particles in the same few directions every time it pops. When there is a high density of particles popping simultaneously it becomes very clear there’s very little randomness going on.

Is there any way to force a fresh randomisation on the first frame of a particle?

A relevant article on this subject: http://effectronica.com/?p=866
A previous thread on this subject that went unanswered: http://forum.unity3d.com/threads/unity-shuriken-burst-randomistaion.166171/

You can change the shape of the emiter for a start, make it a little bigger should already clean part of the problem.

Then as you said you can define a range between 2 constants or even curves to make your particles blow up more or less differently every time. Up to you to pull the right trigger there !

You can tell the particle system spawn particles at this X,Y,Z location with a fixed speed, spawn duration, lifetime, color, etc. This is how you give a steady behaviour to your particles if you have the need for such things.

You can however tell the particle system to spawn particles somewhere in a sphere of radius R at this X,Y,Z location with a speed between 1 and 10, last between 1 and 20s and a color blinking from blue to pink, etc. This is how you get randomness from shuriken.

edit: Added code tags for formatting goodness.

I’ve set most of the particle system module parameters that I use to random between constants and curves. Perhaps it’s working fine with constant emission, and while the burst is random each time the game is started every subsequent instance of that particle has the same “random” properties. Since these particle emitters are likely to pop within close proximity to one another it becomes really obvious they’re all the same.

I’d thought of making several versions of the same particle prefab so that it has several versions to choose from but this seems a really inefficient way of doing things. I’m also considering trying to re-roll the random seed but I’ve yet to test the script.

using UnityEngine;
using System.Collections;

public class ParticleSystemRandomSeed : MonoBehaviour {

    private ParticleSystem ps;
    private uint rs;
    public void Start()
    {
        ps = GetComponent<ParticleSystem>();
        rs = 0; // Should be Random.Range(0,something);
        ps.randomSeed = rs;
    }
    // Update is called once per frame
    void Update () {
    }
}

Something like this. We’llsee if that works when I get around to testing it later on.

A quick update to confirm that the idea of constantly re-randomising the random seed to which the Particle Emitter refers doesn’t change the appearance of prefab particles set to burst. The code I used to check this is below. It’s a bit rough but it should have worked if re-rolling the seed would actually change the appearance of the PE.

I’m out of ideas beyond creating a set of near identical particle emitter prefabs to randomly spawn when needed. If anyone has any other ideas I’d love to hear them.

using UnityEngine;
using System.Collections;

public class ParticleSystemRandomSeed : MonoBehaviour {

    private ParticleSystem ps;
    private uint rs;
    private float rs_float;
   
    public void Start()
    {
        ps = GetComponent<ParticleSystem>();
        rs_float = Random.Range(1,4294967295);

        rs = (uint)rs_float;

        ps.randomSeed = rs;
    }
   
    // Update is called once per frame
    void Update () {
        rs_float = Random.Range(1,4294967295);
        rs = (uint)rs_float;
        ps.randomSeed = rs;
    }
}

Weird! I was just looking around to see if anyone had raised this issue as a new issue in Unity 5.4!
I have just confirmed that burst particle randomization works fine in 5.3. Every time the effect is fired, it looks different.
In 5.4 on the other hand, every time a burst emitter is fired, it looks the same. Even after exiting play mode and playing again, the effect will look the same as it did before.

The issue also presents on iOS.

I’m seeing the same as you in 5.4, Louis. Have you figured out how to fix?

No, the ball is in Unity’s court. I filed a bug and it got flagged as a duplicate of this issue: Unity Issue Tracker - Two independent Particle systems appear to be using the exact same seed for randomisation

These’s a proposed workaround floating about to manually re-randomize the seed, but according to this thread, I’m not even sure it works.