Particles not random?

I’ve just noticed that a particle effect is spawning particles in exactly the same direction each time it’s triggered?

I’d always assumed that random emission directions and other particle values would be different every time the effect was triggered, but it doesn’t seem to be the case right now, you seem to get the same sequence each time (which is quite obvious when you’ve got an effect spawning just a few particles and triggered repeatedly)

Is this normal/expected behaviour? (Do particle systems have their own seeded RNG instances, then? - and if so, is it possible to set the seed?) Or is it a bug? (I’m currently using 5.4.0b13, haven’t tested it on other versions yet)

1 Like

Try setting Unity - Scripting API: ParticleSystem.randomSeed

2 Likes

Also sounds like you have hit this bug: Unity Issue Tracker - Two independent Particle systems appear to be using the exact same seed for randomisation

Yes, looks like that’s it.

Looking in the debug mode inspector, I can see that a new particle system always has the seed set to 1111270184

(Manually changing it does effect the random sequence, but setting it to zero there doesn’t seem to have the intended effect of it picking a random seed value on awake)

Noticed this problem in 5.4 B23 and B24.

We will fix this bug in 5.4, but it looks like we won’t have it fixed in time for the first release.

As Karl says, you can work around it by assigning a random seed yourself via script when instantisting a particle system. It’s not ideal though, so we will be looking to fix it as soon as we can!

Got same bug in 5.4 release version :frowning: Really hope it will be fixed soon!

We are working on it! :slight_smile:

3 Likes

I’ve confirmed that setting ‘ParticleSystem.randomSeed’ does not actually make any changes to the outcome of the particles.

Still an issue in 5.4.0p1 …

Still an issue in 5.4.0f3…cmon guys try harder.

just ran into this issue after updating to 5.4.0f3 :expressionless:

What are they playing at?! It can’t be hard thing to fix.

We are very close to getting a fix into a patch.

It’s taken a little longer than hoped because we felt that the best fix was to expose controls in the inspector to allow you to have a varying random seed, or a fixed one of your choosing. This has meant we needed a bit more time to get it all done and tested.

I promise you it’s my number 1 priority though :slight_smile: I’ll update again when I can confirm which patch it will arrive in.

Sorry for the inconvenience!

4 Likes

Good news - we’ve finally landed the fix :slight_smile:

You can expect it in 5.4.0p4.

We now have 2 new options in the main Particle System settings in the Inspector: Random Seed (number) and Auto Random Seed (check box).

Random Seed maps to the pre-existing script property - if you set any number here, then your particle system will look exactly the same every time it is played. It is only visible/used when the Auto checkbox is unchecked.

Auto Random Seed toggles whether the first property is used. If it is checked, then you will get different random numbers each time the system is played. For example, if you are spawning particles on the surface of a sphere, this controls whether the exact spawn positions chosen on the sphere will be different each time the emitter is triggered (checked), or the same (unchecked).

Particle Systems created in 5.3 or earlier should upgrade to restore the old randomness behavior.
However, systems created in 5.4 will not be able to auto-upgrade, due to the nature of the bug. For these systems, simply tick the Auto Random Seed option, if you want the system to be different each time it is triggered.

Any new systems created after this bug fix will have the checkbox ticked, as that is usually the behavior you want.

5 Likes

Any idea when 5.4.1 or 5.4.0p4 will be released? 5.4.0p3 is not even out yet. PAX West is next week, and non-random particles look awful in our game.

If not, is this the proper work around:

Thanks!

We aim to do weekly patch builds, so in theory p3 will be this week, and p4 next week. However, if QA find issues in any particular patch release, this can make the schedule slip, so I can’t say for sure.

Regarding the workaround, I would expect something like this to work… but I haven’t tried it:

system.Stop();
system.randomSeed = (uint)Random.Range(0,9999999);
system.Play();

Fixed in 5.4.0p4! :smile:

2 Likes

use this to u particle system
Particlerandomseed.cs

5.4.0f3 it’s working!

using UnityEngine;
using System.Collections;

public class Particlerandomseed : MonoBehaviour
{

    void Awake()
    {
        if (this.GetComponent<ParticleSystem>() == null)
            return;

        this.GetComponent<ParticleSystem>().Stop();
        this.GetComponent<ParticleSystem>().randomSeed = (uint)Random.Range(0,9999999);
        this.GetComponent<ParticleSystem>().Play();
    }

}
1 Like

Hello,
Is there a working way to achieve seamless looped particles with PS? I mean like for static particles that should keep their positions between simulations of the particle system.

I HAVE ALREADY TRIED:

  • turning off auto random seed
  • resimulating/clearin/stoping&playing when simulation time reaches its end.

This seems a serious issue to me. I am using U 5.4.3

Best!