Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Particles not random?

Discussion in 'General Graphics' started by bluescrn, Jun 20, 2016.

  1. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    523
    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)
     
    Martin_H likes this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,065
  3. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,065
  4. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    523
    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)
     
  5. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,482
    Noticed this problem in 5.4 B23 and B24.
     
  6. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,581
    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!
     
  7. Pinkerator

    Pinkerator

    Joined:
    Jun 17, 2015
    Posts:
    63
    Got same bug in 5.4 release version :( Really hope it will be fixed soon!
     
  8. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,581
    We are working on it! :)
     
    wizwizyo, KaiClavier and karl_jones like this.
  9. Firedan1176

    Firedan1176

    Joined:
    Dec 7, 2013
    Posts:
    48
    I've confirmed that setting 'ParticleSystem.randomSeed' does not actually make any changes to the outcome of the particles.
     
  10. protostarDean

    protostarDean

    Joined:
    Jun 26, 2014
    Posts:
    7
    Still an issue in 5.4.0p1 ...
     
  11. Gorgor

    Gorgor

    Joined:
    Apr 28, 2012
    Posts:
    51
    Still an issue in 5.4.0f3....cmon guys try harder.
     
  12. wizwizyo

    wizwizyo

    Joined:
    Jul 29, 2013
    Posts:
    3
    just ran into this issue after updating to 5.4.0f3 :|
     
  13. DaveHoskins

    DaveHoskins

    Joined:
    Sep 9, 2013
    Posts:
    190
    What are they playing at?! It can't be hard thing to fix.
     
  14. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,581
    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 :) I'll update again when I can confirm which patch it will arrive in.

    Sorry for the inconvenience!
     
  15. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,581
    Good news - we've finally landed the fix :)

    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.
     
  16. Radiangames2

    Radiangames2

    Joined:
    Aug 22, 2012
    Posts:
    36
    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:
    1. Particle.randomSeed = (uint)Random.Range(0,9999999);
    2. Particle.Simulate(0, true, true);
    3. Particle.Play();
    Thanks!
     
  17. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,581
    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:

    Code (CSharp):
    1. system.Stop();
    2. system.randomSeed = (uint)Random.Range(0,9999999);
    3. system.Play();
     
  18. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,134
    Fixed in 5.4.0p4! :D
     
    karl_jones and richardkettlewell like this.
  19. fscrazy

    fscrazy

    Joined:
    Nov 28, 2014
    Posts:
    4
    use this to u particle system
    Particlerandomseed.cs

    5.4.0f3 it's working!

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Particlerandomseed : MonoBehaviour
    5. {
    6.  
    7.     void Awake()
    8.     {
    9.         if (this.GetComponent<ParticleSystem>() == null)
    10.             return;
    11.  
    12.         this.GetComponent<ParticleSystem>().Stop();
    13.         this.GetComponent<ParticleSystem>().randomSeed = (uint)Random.Range(0,9999999);
    14.         this.GetComponent<ParticleSystem>().Play();
    15.     }
    16.  
    17. }
    18.  
     
    richardkettlewell likes this.
  20. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    206
    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!
     
  21. FirstProgram

    FirstProgram

    Joined:
    Nov 18, 2016
    Posts:
    1
    Hi, so i did uncheck the Auto Random Seed box and put some random number like 1000 on the random seed box, but for reason the effect is still randomly spawning at random places. I want it at the same spot every single time but it's not working. How do I fix this? Using Unity 5.50f3
     
    Last edited: Apr 25, 2017
  22. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,581
    I can only guess without seeing the project.. e.g. it's important to configure the seed before simulating the effect. Setting it during playback won't have any effect.

    Another guess: you're hitting this bug, which will be fixed soon: https://issuetracker.unity3d.com/is...randomized-when-particle-system-is-not-looped

    If that doesn't help you, consider submitting a project as a bug report, demonstrating the problem you're having. Then we can help you further.
     
  23. BrandedBeast

    BrandedBeast

    Joined:
    Dec 29, 2017
    Posts:
    2
    Hello,
    I am running 2017.3 and it appears that I am still running into the sub Emitter particle systems not being random even with Auto Random Seed checked. Setting the individual sub emitters to looping does not seem to do anything. If I set the "parent" Particle system to looping than randomization seems to work on all the sub Emitters. If the "parent" particle system is not looping I lose randomization on all the sub emitters.

    Is there a setting I am missing or is this the same bug as stated above?
     
  24. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,581
    Hi,

    The original bug is fixed, so you may want to submit a new bug report for us to investigate.

    Thanks,
     
    karl_jones likes this.
  25. BrandedBeast

    BrandedBeast

    Joined:
    Dec 29, 2017
    Posts:
    2
    gotcha. Thanks.
     
  26. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    206
    Well thanks a lot! This is the most awaited PS feature for me.
     
    richardkettlewell likes this.
  27. devteamsolar

    devteamsolar

    Joined:
    Jun 7, 2019
    Posts:
    2
    I thought I had this error but it turned out I just had under the shape module, Arc>Mode set to Loop instead of Random!
     
    richardkettlewell and karl_jones like this.
  28. WookieWookie

    WookieWookie

    Joined:
    Mar 10, 2014
    Posts:
    16
    This bug is back in 2019. Please fix PERMANENTLY. Blocked by this simple request to randomize images on a sheet, guys. Years.
     
  29. WookieWookie

    WookieWookie

    Joined:
    Mar 10, 2014
    Posts:
    16
    It is not fixed in 2019.
     
  30. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,581
    Hi, you’ll need to submit a bug report with some detail about what problem you’re facing.

    There isn’t any prior mention of randomising images on a sheet in this thread, and it’s quite hard to help you when that is the only detail you’ve given.

    If you really are blocked, a polite and detailed request for help would speed things up for you. You are welcome to reply with the case number once you have submitted the bug report - it will help me find the report in our system.

    Best Regards,
     
    karl_jones likes this.
  31. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    8,960
    If you have a particle system in which you've manually set the seed & unchecked Auto Random Seed, it will not be random. But that's by design. I noticed some particle systems imported from an older broken version of Unity would retain the original non-random behavior until you check Auto Random Seed back on.
     
unityunity