Search Unity

change variable in runtime

Discussion in 'Scripting' started by mrttis, Jul 2, 2015.

  1. mrttis

    mrttis

    Joined:
    Jul 12, 2012
    Posts:
    64
    Hi,

    My code must work for random variable in random time.
    or in other words I want change a random variable in runtime but It will change at end of every ten seconds(or in random time) ?
    i could not.

    How can i add random time for change variable in runtime?

    Code (JavaScript):
    1. #pragma strict
    2.  
    3.  
    4. public static var spdGrupOne = Random.Range(12,18);
    5.  
    6. function Start () {
    7.  
    8. }
    9.  
    10.  
    11. function Update () {
    12.  
    13.     Debug.Log(spdGrupOne);
    14.  
    15. }
    16.  
     
    Last edited: Jul 2, 2015
  2. mrttis

    mrttis

    Joined:
    Jul 12, 2012
    Posts:
    64
    Problem solved.
    thanks