Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Shuriken ParticleSystem.randomSeed has no effect

Discussion in 'Scripting' started by benhumphreys, Jul 8, 2014.

  1. benhumphreys

    benhumphreys

    Joined:
    Jan 20, 2013
    Posts:
    30
    Hi,

    Setting the randomSeed on a particle system works in debug mode in the inspector.

    However setting it from this script seems to have no effect.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ParticleRandomTester : MonoBehaviour
    5. {
    6.     void Awake()
    7.     {
    8.         var ps = gameObject.GetComponent<ParticleSystem>();
    9.         ps.randomSeed = 42;
    10.     }
    11. }
    Can someone tell me what I'm doing wrong?
     
  2. benhumphreys

    benhumphreys

    Joined:
    Jan 20, 2013
    Posts:
    30
    Nevermind I found out how.

    You have to use ParticleSystem.Simulate(0, true, true); to actually reset the particle system and get it to use the new randomSeed value.

    Of course.
     
  3. Deleted User

    Deleted User

    Guest

    Why on Earth did that work, thank-you Ben, just wasted an hour scouring the documentation for what you've summed up in 20 seconds. Very odd decision by Unity there
     
unityunity