Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

can you setup a "random between 2 constant" on ParticleSystem.startLifetime [Solved]

Discussion in 'Scripting' started by krousty_bat, Feb 11, 2016.

  1. krousty_bat

    krousty_bat

    Joined:
    Oct 9, 2012
    Posts:
    60
    Hi

    I was not able to find any answers from google or
    http://docs.unity3d.com/ScriptReference/ParticleSystem-startLifetime.html on this one.

    My question is pretty much the title
    Can you, using a C# script, ask a ParticleSystem.startLifetime to be a "random between 2 constant" ?
    I succeeded only to write one value so far, like this
    Code (CSharp):
    1.             Particles.startLifetime = 0f;
    for instance, to turn off slowly a smoke particle system (and not like a switch ON/OFF).

    Thx.
     
    Last edited: Feb 11, 2016
  2. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
    Code (csharp):
    1.  
    2. Particles.startLifetime = Random.Range(0f, 256f);
    3.  
     
    krousty_bat likes this.